Jump to content

Recommended Posts

Posted

Infil Panels-Layout1.pdfInfil Panels-Layout1.pdfInfil Panels-Layout1.pdfInfil Panels-Layout1.pdfInfil Panels-Layout1.pdfInfil Panels-Layout1.pdfHi All. I'm after some help with this pleasae.

I want to insert 4 blocks into my drawing to form a square shape. The original 4 entities  that I made are polylines and are saved as blocks in one drawing called BLOCKS_1.

I start a new drawing and insert  BLOCKS_1 into my drawing. This then makes the 4 polyline blocks available in my current drawing.

I am then inserting the 4 blocks each at their relative 0,0,0 point which arranges the blocks how I want them.

Heres where I cant get the join command to work. (I can manually join the 4 entities together using the JOIN command)

After inserting the 4 blocks I am exploding them so they are now polylines and their end points are touching to form a square.

this is an example of the code to only insert and explode 1 of the entities. I repeat this insert 3 more times, and change the ENTLAST to Ent2 Ent3 Ent4

 

(command "-insert" "Infil_HL" (0.0 0.0 0.0) "" "" "") ;Infil_HL is the block name one of the 4 entities thast are present in the drawing
(setq Ent1 (entlast))
(command "_explode" Ent1)

 

now when I run the join command it won't join the 4 entities into one.

 

(command "_join" Ent1 Ent2 Ent3 Ent4)

 

Regards Tony

Posted (edited)

little background on how DWG drawings work or how I understand. When you create or modify anything in a drawing it puts it at the end of drawing list. that is why you can select the last thing with (entlast) The blocks you are inserting is a made up of entity's and when you explode the block its gone but it's entity's are left in the drawing. even if its only one item its now under a different entity name. Your join command is saying join block 1 2 3 4 but you exploded them. you have to build another selection set of those entity's to join. so you create a place holder in the Drawing list with LastEnt insert and explode your block. then with the while its basically saying anything after this point in the list add to selection set SS. then pass the SS  to the join command.

 

(setq SS (ssadd))  
(setq LastEnt (entlast)) 
(command "-insert" "*Infil_HL" '(0.0 0.0 0.0) "" "" "")
(command "-insert" "*blk2" '(0.0 0.0 0.0) "" "" "") ;ent2
(command "-insert" "*blk3 '(0.0 0.0 0.0) "" "" "") ;ent3
(command "-insert" "*blk4" '(0.0 0.0 0.0) "" "" "") ;ent4
(while (setq LastEnt (entnext LastEnt))
  (ssadd LastEnt SS)
)
(command "_join" SS)

 

-edit 

adding * infront of the block name AutoCAD inserts and immediately explodes it in one step.

Edited by mhupp
  • Like 1
  • Thanks 1
Posted
5 hours ago, mhupp said:

adding * infront of the block name AutoCAD inserts and immediately explodes it in one step.

 

I didn't know that

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...