how to create dynamic blocks in VBA

how to create dynamic blocks in VBA

bkovan
Explorer Explorer
2,280 Views
5 Replies
Message 1 of 6

how to create dynamic blocks in VBA

bkovan
Explorer
Explorer

Hi, I am looking to see how to create a dynamic block in VBA?

Essentially, I want to import a dynamic block, add or remove actions, and save it (re-create it).

 

I understand how to create a regular block, how do you import the dynamic block properties, actions, stretch etc.?

0 Likes
2,281 Views
5 Replies
Replies (5)
Message 2 of 6

norman.yuan
Mentor
Mentor

There is no API exposed/supported in AutoCAD's COM/.NET API for defining block's dynamic properties. So, no, you cannot use VBA to do what you want.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 6

Anonymous
Not applicable

You may have to resort to using lisp entmake called from your vba take a simple dynamic block say a rectang and pull it apart. Getting into the extended parts about constraints.

0 Likes
Message 4 of 6

Anonymous
Not applicable

You should be able to do with VBA I just created a dynamic object from scratch that has a dynamic radius , my reference was code from Togores, Reinaldo N.. Programming 3D. Solids, Meshes & Surfaces. (AutoCAD expert's Visual LISP) a book I bought from Kindle for a few dollars well worth the investment.

make a shape then use 

(vl-cmdf "_AutoConstrain" (entlast) "") 

(vl-cmdf "_DcRadius" (getpoint "p1")(getpoint " p2")) add other constraints.

(vl-cmdf "_DcVertical" (getpoint "p1")(getpoint " p2"))

 

ScreenShot125.jpg

 

 

0 Likes
Message 5 of 6

sanchezemail
Participant
Participant

May be..  Import XML (LandXML) 

0 Likes
Message 6 of 6

Anonymous
Not applicable

You can't create dynamic blocks using VBA. However, you can create a dynamic block with AutoCAD and then insert it into a drawing modifying it's properties. Cheers!

0 Likes