.NET

Reply
Active Member
bobbyg
Posts: 7
Registered: ‎04-18-2012
Message 1 of 5 (166 Views)
Accepted Solution

The Content Builder and the API

166 Views, 4 Replies
07-26-2012 05:49 AM

I build MEP models with the Content Builder. Pretty much every model that I build will have the same parameters: box length/width/height, inlet length/width/height, outlet length/width/height, etc. I would like to know if there's any way to programmatically add those parameters to a model. Thanks!

There is no API for the Content Builder. What you can do is start a 'blank' part and create the parameters and then save the part in your favorite location. Next time open the part and use save as to place the part in the appropriate location. Another option might be to try and manipulate the XML file programmatically. Not sure how this will effect the dwg file though. Good luck!

You can use vbscript in content builder but here are very limited commands that you can use.  They are the condiditonal statements, (greater than, less than, equal, etc, and then If-then-else statements.  This will allow you to drive your geometry I believe.  If Hand = 1 then parameter = x else parameter = y.  You can also validate and restrict certain sizes.  For example, using a part size validation test and setting its formula equal to Total Length > Length A + Length B.  If this statement becomes false when inputing values into Length A and Length B, it will not allow the value to be entered.  This can make sure that the user does not 'break' your part.  I believe that in order to have access to these types of functions you will have to activate the advance mode of content builder which is done by typing pfadvanced at the command line.

 

Good Luck!

*Expert Elite*
Keith.Brown
Posts: 1,141
Registered: ‎03-13-2008
Message 2 of 5 (163 Views)

Re: The Content Builder and the API

07-26-2012 06:12 AM in reply to: bobbyg
There is no API for the Content Builder. What you can do is start a 'blank' part and create the parameters and then save the part in your favorite location. Next time open the part and use save as to place the part in the appropriate location. Another option might be to try and manipulate the XML file programmatically. Not sure how this will effect the dwg file though. Good luck!

Keith Brown AutoCAD MEP BLOG | RSS Feed
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
Active Member
bobbyg
Posts: 7
Registered: ‎04-18-2012
Message 3 of 5 (152 Views)

Re: The Content Builder and the API

07-26-2012 06:51 AM in reply to: bobbyg

I appreciate your reply. The idea for saving a part template is a good one--I'll definitely start doing that. I however think that programmatically manipulating the XML is out of the question. Each parameter has an ID and an index, and I don't want to start adding random values. 

 

I have one more question: I've seen that in the 'part size name' parameter you can use VB or some scripting language to manipulate the values. I use left and right hand values for my models; in order to do this, I have a hand flag and a usually large equation that moves certain profiles around based on the hand flag. It would be MUCH easier to be able to have a script that moves a dimension value based on the hand flag so I don't have to figure the equations out myself. Do you know of a way to do this? Thanks again.

*Expert Elite*
Keith.Brown
Posts: 1,141
Registered: ‎03-13-2008
Message 4 of 5 (148 Views)

Re: The Content Builder and the API

07-26-2012 08:22 AM in reply to: bobbyg

You can use vbscript in content builder but here are very limited commands that you can use.  They are the condiditonal statements, (greater than, less than, equal, etc, and then If-then-else statements.  This will allow you to drive your geometry I believe.  If Hand = 1 then parameter = x else parameter = y.  You can also validate and restrict certain sizes.  For example, using a part size validation test and setting its formula equal to Total Length > Length A + Length B.  If this statement becomes false when inputing values into Length A and Length B, it will not allow the value to be entered.  This can make sure that the user does not 'break' your part.  I believe that in order to have access to these types of functions you will have to activate the advance mode of content builder which is done by typing pfadvanced at the command line.

 

Good Luck!


Keith Brown AutoCAD MEP BLOG | RSS Feed
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
Active Member
bobbyg
Posts: 7
Registered: ‎04-18-2012
Message 5 of 5 (140 Views)

Re: The Content Builder and the API

07-26-2012 09:27 AM in reply to: Keith.Brown

That works perfectly! Thank you very much for all of your help.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.