Macro to automate drawing an object and intersection of members

Macro to automate drawing an object and intersection of members

bos3UYUJ
Contributor Contributor
490 Views
2 Replies
Message 1 of 3

Macro to automate drawing an object and intersection of members

bos3UYUJ
Contributor
Contributor

Good afternoon,

 

I'm looking to write a VBA macro which interfaces with the ROBOT API to perform the following tasks:

- Draw an object of a chosen dimension and location in my model (either a square or circle)

- Change the object to members by clicking 'discretization'

- Find the intersection of the new object's members with the existing model's members

- Create new members at the intersections

- Output the length of the new members

 

I have attached a photograph to help demonstrate the steps that I am looking to automate. Can you please let me know if this is possible and if you have any similar examples already written?

 

Many thanks

ROBOT Forum Question.png

0 Likes
Replies (2)
Message 2 of 3

Stephane.kapetanovic
Mentor
Mentor

hi @bos3UYUJ 

What you are asking is to create bars and nodes. You just need to search this forum for some code to get started, for example by searching for "API Nodes", "API Create", etc.
For the intersections of your rectangle with the existing bars you need to search on a forum dedicated to 3D geometric algorithms either to intersect a polygon with a line segment or from one bar to another. Then you make the loop on the elements of the considered region and cut your bars as many times as you meet intersections.
It is possible that in your case you can summarize to just a few bars or if your geometry is known to loop only on the expected elements.
Note also that you can create intersections by adding nodes without segmenting the bars.

 

https://forums.autodesk.com/t5/robot-structural-analysis-forum/create-nodes-api/m-p/9165126
https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-lines-to-bars-converter-addin/td-...
https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-addin-for-creating-clossest-nodes...
https://stackoverflow.com/questions/5514366/how-to-know-if-a-line-intersects-a-rectangle

 

Depending on the size of your model and the number of rectangles to insert, programming may be more or less arduous and long in execution time. You could use a dwg background and simply copy the rectangles manually by using the background to register them or copy paste them from one model to another then make a global intersection.

Best regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 3 of 3

bos3UYUJ
Contributor
Contributor

Hi @Stephane.kapetanovic,

 

Thank you for your quick and very helpful reply. I have to replicate this process many many times so it will be advantageous to script it.

I will start creating the macro now using the links you shared as inspiration.

 

Best wishes

0 Likes