Jump to content

Change insert point of a block from multiple files


Charpzy

Recommended Posts

I've made a bit of a mistake when creating multiple blocks, I put the insert point at the wrong place (i'm about 200+ blocks deep into it now). what makes it harder to change each block is in a different file, which in then in sub folder for another script to easily pull them

 

is it possible to create a script to run so it can go through all the files/ folders and change the insert point rather than manually going through each one and changing them?

 

this would be a huge time saver if possible

Link to comment
Share on other sites

The batch part is easy - look at Lee Macs site, or Scriptpro

Hosneyalaa has a good solution... if you are going through the files one by one but not sure if that would work for a batch.

 

How are your block references saved? If you could post a sample drawing then we can see what needs to be done.

 

Also if you can say whether al the base points will be the same point (for example, the origin 0,0,0) or relative to a part of the drawing.

 

Last question, you do mean base point and not moving all the parts of the block so that the required base point is actually at the origin of the block

 

 

Trying to work out the rules you need to follow, so that a LISP can do the work... get it to work on one drawings.. and it should work on them all

Link to comment
Share on other sites

Hosneyalaa solution, Lee Macs base point tool will do the trick ill just have to manually do all blocks, thanks

I've realised though that because I've used some of the blocks in other drawings and templates, when I insert them into that file again the base point doesn't changes I have to remove the block reference and reinsert.

 

essentially what I'm making is a tool which inserts a block with a leader to it for a label, but at the moment I've got the leader inserting to the insert point of the block, how could I get the centre point of a block so I can draw a leader/ line from that point?

Link to comment
Share on other sites

22 minutes ago, Charpzy said:

how could I get the centre point of a block so I can draw a leader/ line from that point?

(VL-LOAD-COM)
(SETQ E (SSNAME (SSGET "_:S+." '((0 . "insert")))))
(VLA-GETBOUNDINGBOX (VLAX-ENAME->VLA-OBJECT E) 'LL 'UR)
(SETQ LL- (VLAX-SAFEARRAY->LIST LL)) ; low left xyz point
(SETQ UR- (VLAX-SAFEARRAY->LIST UR)) ;up rigth XYZ point
(SETQ LL-ID (MAPCAR '/ (MAPCAR '+ LL- UR-) '(2 2 2))) ; the blockreference central point

 

  • Like 1
Link to comment
Share on other sites

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...