|
[Sponsors] |
[DesignModeler] Script to Update/Refresh CAD Import |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 7, 2017, 15:13 |
Script to Update/Refresh CAD Import
|
#1 |
New Member
John
Join Date: Dec 2012
Posts: 8
Rep Power: 13 |
Hello,
I have a simple question regarding scripting in DesignModeler. I have looked through these forums and the ANSYS help guide (which is no where near listing the full functionality of DesignModeler) and I have not been able to answer my question. I have a DesignModeler file which imports multiple geometries (.step files) and performs a few Boolean operations before naming each face and exporting to the mesher. I need to run this 1000s of times in an automated environment so I will need to use some scripting. I thought the simplest approach would be to keep all of the operations in the DesignModeler project, and simply update the step files and refresh the project. If i manually refresh the file path with a new step file everything works. However, changing (even deleting ) the step files and refreshing the project from workbench does not update the geometry as I would have hoped. There must be a local copy of the geometries made somewhere. So my question is simple, how do you script the change of a path of a DesignModeler Import, or refresh the import so that DesignModeler reloads the file at the same path in an automated/scripted fashion? I came across the following topic on this forum which partly answers my question: DesignModeler Scripting: How to get Full Command Access But this describes how to make a new CAD import, rather than update an existing one. This could work but would require that I script many other commands to create my final geometry, which is not an option. One a side note, is there functionality in DesignModeler to record commands from the GUI like there is in ICEM? Otherwise it seems like an impossible task to guess what the syntax and command names are for each of the GUI functions. Many thanks for your help in advance John |
|
August 7, 2017, 19:11 |
|
#2 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
sadly you cant record in DM like in ICEM.
so basically you have to hard code the whole thing. to update the DM you have to do exact same operation as first import really. I tired doing update import with different path but it dint work. Its been long but I can have a look again. Cheers KAPI |
|
August 8, 2017, 04:00 |
|
#3 |
New Member
John
Join Date: Dec 2012
Posts: 8
Rep Power: 13 |
Thanks for you reply KAPI,
When you attempted this before what did you try? So I am happy with importing new files like this: Code:
// import file var imp1=ag.b.Import("I:\\1.step"); // IAnsImport imp1.Name="CAD_geom"; imp1.Operation=ag.c.Frozen; imp1.PutBasePlane(ag.b.GetXYPlane()); Code:
var imp1 = ag.b.GetImportByName('CAD_geom') // a function to recall an existing import |
|
August 8, 2017, 05:50 |
|
#4 |
New Member
John
Join Date: Dec 2012
Posts: 8
Rep Power: 13 |
OK, so I have managed to answer my own question. Hopefully it will be of use use to someone else.
Code:
var selected_import; selected_import = ag.gui.TreeviewFeature('TEST', 0); // 'TEST' is the name given to the import selected_import.Name = 'TEST' selected_import.SourceName = 'I:\\updated_file.step' selected_import.Refresh = 1; |
|
September 22, 2020, 17:49 |
|
#5 | |
New Member
Stéphane MONTESINO
Join Date: Sep 2020
Location: Europe
Posts: 2
Rep Power: 0 |
Hi Jotter,
I tried this script to update a Catia file import but I got an error message concerning the file format. Do you know if there is any option to specify? Thanks in advance. Quote:
|
||
September 22, 2020, 18:53 |
|
#6 | |
New Member
Stéphane MONTESINO
Join Date: Sep 2020
Location: Europe
Posts: 2
Rep Power: 0 |
Quote:
I did 2 mistakes in my code: I copy paste the file path (using shift + right click) and I had in my code: Code:
selected_import.SourceName = '"D:\Workbench\Cube_New.CATPart"'
The code that worked for me is: Code:
selected_import.SourceName = 'D:/Workbench/Cube_New.CATPart' Jotter, thanks a lot for your code. I also hope that my mistake can help those who try to script within Ansys. Last edited by STF#00; September 22, 2020 at 18:54. Reason: emphasize code |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
In Workbench Mechanical, create a script to import external loads | grahamrigs | ANSYS | 0 | April 20, 2017 18:05 |
Can OpenFOAM currently import CAD geometry? | Davitt | OpenFOAM Pre-Processing | 2 | November 2, 2015 07:46 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 03:23 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 20:30 |
I-DEAS CAD data import with boundary conditions | Yunus | FLUENT | 2 | March 14, 2001 14:45 |