insert block script with layer

insert block script with layer

sdhara.hit
Advocate Advocate
406 Views
3 Replies
Message 1 of 4

insert block script with layer

sdhara.hit
Advocate
Advocate

I want to insert block by script in different layer . I have x,y,rotation,block name & layer name, what will be script for insert block ?

0 Likes
Accepted solutions (1)
407 Views
3 Replies
Replies (3)
Message 2 of 4

Tomislav.Golubovic
Advisor
Advisor

You want a script, VBA or .Net?

0 Likes
Message 3 of 4

Michiel.Valcke
Advisor
Advisor
Accepted solution

to make a script, 
make a notepad txt file and type the exact input that you are typing into the command bar including enters (not spaces)
Start by turning of the object snaps so that your insertion point for the block will be respected.

OSMODE
0
-LAYER
S
YourLayerName

-INSERT
YourBlockName
YourXValue,YourYValue
1
1
YourRotationValue
OSMODE
143

 then type what you want. The above is untested, you can modify as needed. Usually it's the amount of enters that is causing an issue. Save the notepad.txt with a .scr extension and you can drag it into your drawing.

To make a macro replace the enters with a semicolon ;

If you want a lisp version with more user control or a VBA or .NET version there is another forum full of people that can help you with that.
https://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1


 

0 Likes
Message 4 of 4

tramber
Advisor
Advisor

You can also use the CHPROP command with the L (standing for Last object as a selection) followed by a double Enter before choosing the Layer option.

In a word you can also build a script with a different layer specification at every insertion instead of changing the currentlayer.

 

CHPROP Last  Layer "my layer"  (double enter to get out the CHPROP command)

something like that 😉


EESignature