CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[Workbench] DesignSpace Scripting: How to get Full Command Access

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Kapi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2014, 05:05
Default DesignSpace Scripting: How to get Full Command Access
  #1
New Member
 
Alexander
Join Date: May 2014
Posts: 7
Rep Power: 11
BaoBab is on a distinguished road
I have some experience in full command access in DesignModeler posted here and whant to share some more on DesignSpace (Mechanical utility).
It also support JScript through Tools->Run Macro.
What is behind that?
First of all see "<ANSYS>...\aisol\DesignSpace\DSPages\scripts" .
Then inspect
Ans.Simulation.AppletCOM.dll
Ans.Simulation.ObjectsCOM.dll
with "ole/com object viewer" from Microsoft Visual Studio SDK (OleView.exe)
Most of definitions are there/
Te main scripting object in DesignSpace is... "DS" !!

Code:
var tree=DS.Tree ;// IDSTreeRootAuto
var branches = DS.Tree.Branches; // IDSCollectionAuto

WBScript.Out("Tree has:"
    +"\nName="+tree.Name
    +"\nId="+tree.ID
    +"\nClass="+tree.Class
    +"\nBranches Count="+branches.Count
, true);

for(var i=1; i<=branches.Count;i++)
{
    var br1=branches.Item(i);    // IDSBranchAuto
    var proj=br1.Project;          // IDSProjectAuto
    var model=br1.Model;          // IDSModelAuto
    var mcgrp=br1.MeshControlGroup;    // IDSMeshControlGroupAuto
    var csgrp=br1.CoordinateSystemGroup; // IDSCoordinateSystemGroupAuto
    var env=br1.Environment;    // IDSEnvironmentAuto
    var ctgrp=br1.ContactGroup;    // IDSContactGroupAuto
    var awset=br1.AnswerSet;    // IDSAnswerSetAuto
    var cggrpset=br1.ComponentGroup;// IDSComponentGroupAuto

    WBScript.Out("Project has:"
        +"\nName="    +proj.Name
        +"\nId="    +proj.ID
        +"\nClass="     +proj.Class
    ,true);
    WBScript.Out("Model has:"
        +"\nName="    +model.Name
        +"\nId="    +model.ID
        +"\nClass="     +model.Class
    ,true);
    WBScript.Out("MeshControl Group has:"
        +"\nName="    +mcgrp.Name
        +"\nId="    +mcgrp.ID
        +"\nClass="     +mcgrp.Class
    ,true);
}
BaoBab is offline   Reply With Quote

Old   April 21, 2015, 10:57
Default
  #2
New Member
 
narjisse
Join Date: Apr 2015
Posts: 5
Rep Power: 11
minou is on a distinguished road
Hi BaoBab,

Thank you for your post!

I have a problem, I want to use some command that are described in your script but when I run my script. I have an error message: DS undefined

Can you help me please!
Thank you,
minou is offline   Reply With Quote

Old   April 21, 2015, 18:46
Default
  #3
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Minou,

You have to define DS first if you havent!

Code:
var ds = WB.AppletList.Applet("DSApplet").App.Script.ds;

Hope it helps

Cheers
KAPI
lifespantree likes this.
Kapi is offline   Reply With Quote

Old   April 22, 2015, 01:40
Default
  #4
New Member
 
narjisse
Join Date: Apr 2015
Posts: 5
Rep Power: 11
minou is on a distinguished road
Many thanks Kapi for your answer!

When I defined DS as: var ds = WB.AppletList.Applet("DSApplet").App.Script.ds;

I had an error message: WB undefined.
Can you help me please
Thank you,
minou is offline   Reply With Quote

Old   April 22, 2015, 01:48
Default
  #5
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Minou,

are you working on DesignModeler or DesignSpace(Mech Utility)?


Cheers
KAPI
Kapi is offline   Reply With Quote

Old   April 22, 2015, 01:51
Default
  #6
New Member
 
narjisse
Join Date: Apr 2015
Posts: 5
Rep Power: 11
minou is on a distinguished road
Hi Kapi,

I am working on the DesignModeler.

Thank you,
minou is offline   Reply With Quote

Old   April 22, 2015, 01:54
Default
  #7
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Minou,

the above code posted by Baobab is for designSpace, Please post your query on DesignModeler thread!


Cheers
KAPI
Kapi is offline   Reply With Quote

Old   February 9, 2018, 07:02
Default
  #8
New Member
 
Join Date: Feb 2018
Posts: 2
Rep Power: 0
lifespantree is on a distinguished road
Thank you very much!
lifespantree is offline   Reply With Quote

Old   February 9, 2018, 07:04
Default
  #9
New Member
 
Join Date: Feb 2018
Posts: 2
Rep Power: 0
lifespantree is on a distinguished road
I am new to Ansys scripting and have read a lot of your posts. You are not quite active now, but I really want to thank you. Thanks.
lifespantree is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rotor 67 full compressor geometry jf Main CFD Forum 3 January 28, 2024 05:14
[ICEM] ICEM Scripting Issues tylerplowright ANSYS Meshing & Geometry 33 September 27, 2021 16:35
Macro scripting in netbeans, importing star libraries laurensvd STAR-CCM+ 3 October 31, 2020 22:06
[DesignModeler] DesignModeler Scripting: How to get Full Command Access ANT ANSYS Meshing & Geometry 53 February 16, 2020 15:13
Discrepancy ensight slice and full data for parallel decomposed case Japsor OpenFOAM Bugs 0 August 27, 2013 04:47


All times are GMT -4. The time now is 20:45.