Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Script drawing defined shape in many locations

Anonymous

Script drawing defined shape in many locations

Anonymous
Not applicable

Hi,

 

I've found a number of resources detailing how to draw circles or squares (or other predefined shapes) at various locations with a script but would like to draw a different shape (say, a dog) that I've created.

 

Basically, I've made a series of custom shapes and would like to supply a list of center point coordinates and have the software draw them there. Is this possible/easy? Or would I be better off drawing the things in another program then importing them as a vector graphic?

 

Cheers,

Ben

0 Likes
Reply
Accepted solutions (1)
1,003 Views
6 Replies
Replies (6)

pendean
Community Legend
Community Legend
Q: why not have these shapes are blocks and just insert them with this script instead of the agony of having to code for "drawing" each from scratch?
0 Likes

steven-g
Mentor
Mentor
Accepted solution

From the sound of your description I would say that turning your shapes into blocks would be the best method, you can define the center point as the blocks base point and a block can be scaled and rotated easily, as well. Though a script would be possible it makes no logical sense. Unless there are other reasons for wanting to use a script

0 Likes

Anonymous
Not applicable

"Blocks" sound like a great way to do this. I have to admit my ignorance here, which is why I didn't suggest blocks to start with. 

 

Rephrased:  Is it relatively simple to programmatically draw ~500 blocks by providing a list of center points?

0 Likes

pendean
Community Legend
Community Legend
It relatively simple to programmatically to INSERT PRE-DRAWN ~500 blocks by providing a list of center points if you are willing to take the time to populate the database that does that first.
0 Likes

steven-g
Mentor
Mentor

Iit's fairly straightforward in excel, if you use columns A and B to populate your x,y coordinates then use column C with 2 simple formulas, shown in the image

Insert.jpg

cell C1 starts the insert command using the name of a block that is already defined in your drawing with the correct center point

cell C2 has the formula to give the coordinates and this is copied down for as often as you need

I have used column D just to show where you have to use a space in the formula indicated with "°" because some places you have to use a single space and others require a double space.

Select the indicated cells and press Ctrl+c (copy) then in autocad make sure the command line is active click on it twice and then press Ctl+v (paste)

Be aware that zoom level and other objects in the drawing can influence how this works

 

 

0 Likes

Emmsleys
Alumni
Alumni

Feel free to post back if you continue to run into any issues or need additional help. 



Sarah Emmsley
Technical Support Specialist

0 Likes