|
[Sponsors] |
[DesignModeler] JScript for promoting imported CAD parameters to Workbench and using Named Selections |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 19, 2016, 05:24 |
JScript for promoting imported CAD parameters to Workbench and using Named Selections
|
#1 |
New Member
CW
Join Date: Jan 2015
Posts: 4
Rep Power: 11 |
Hi,
I am having troubles promoting my CAD parameters to workbench with jscript. This is the command achieved in the gui by selecting the paramaters and "checking" them in the list. I have tried the following code and it doesn't work: Code:
ag.listview.ActivateItem("DS_Thickness"); ag.listview.ItemValue = 40; ag.listview.SelectedItem.IsChecked="true"; Also on another note, does anyone know how to use imported named selections with jscript? I have one called NS_INNERSURFACE but I was unable to use it with the following command, Code:
ag.facePick; agb.AddSelect(agc.TypeFace, NS_INNERSURFACE); Code:
var NS_INNERSURFACE = ag.m.ModelFaces(4); |
|
September 19, 2016, 22:24 |
|
#2 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
are you activating body before activating its properties?
also check if your NS is coming when you import geometry! once imported, you can call them with that code Last edited by Kapi; September 20, 2016 at 02:31. |
|
September 28, 2016, 07:23 |
|
#3 |
New Member
CW
Join Date: Jan 2015
Posts: 4
Rep Power: 11 |
Thanks for the response. Sorry for such a late reply.
I have changed my method and do not need to do the steps as I posted above. Instead I will only use my named selections in the meshing step and for that it is working! I do not know why it did not work in DM as they were being imported correctly. On a side note (I don't know if I should make a seperate thread for this), I am currently editing my mesh with the listview commands. These work if I set interactive mode to True but do not if I set interactive mode to False. Do you know any method to get these commands to work in batch mode? I have tried, for example, the command, Code:
var Mesh_Mod = DS.Tree.FirstActiveBranch.MeshControlGroup; DS.Script.SelectItems(""+Mesh_Mod.ID); DS.Script.lv.ActivateItem("Physics Preference"); DS.Script.lv.ItemValue = "CFD"; |
|
September 28, 2016, 19:55 |
|
#4 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
I reckon u r after this!
Code:
// access MeshControlGroup var meshGroup = ds.Tree.FirstActiveBranch.MeshControlGroup; ds.Script.changeActiveObject(meshGroup.ID); // specify global mesh settings meshGroup.PhysicsPreference = 2; meshGroup.SmoothingOption = 2; meshGroup.SpanningAngleSF = 10; meshGroup.MinSizeSF = 0.0001; meshGroup.MaxFaceElementSize = 0.005; meshGroup.MaxSizeSF = 0.375; // update mesh tree ds.Script.fillTree(); Cheers KAPI |
|
|
|