Jump to content

Align selected blocks to polyline


Janouren

Recommended Posts

Good day,

I've been tasked with rotating a lot of blocks in map drawings in such a way that they are aligned with the line below them, as seen on the picture below. It was explained to me to do this manually for each drawing, which can be thousands of these operations. To save my sanity, I've looked around the forum and the internet for a LISP that would help me do this task automatically, but to no success. Could anyone please help me automate this or at least point me to a right direction?
 

Initial conditions:
-centers of blocks lie on a polyline
-polyline and blocks are the same layer
-there is always only 1 polyline intersecting the block's center point
-forward/back direction of the assymetrical blocks, like the triangle on the pic below, is not relevant (likely can't be automated, requires context to decide)

Ideally (if possible) the user input for this script would be:
-select relevant blocks
-select relevant polylines

LISPs that I've been using so far (this forum is awesome!):
-replace all selected blocks with another block (LISP by alanjt)
-replace list of blocks with another list of blocks (LISP by tharwat and modified LISP by ronjonp to use wildcards)

The problem:
image.png.56dda3cd3cf6fec9c326cec01313fc9b.png

  • Like 1
Link to comment
Share on other sites

It seems like all you have to do is rotate all the blocks 90 degrees .
https://autocadtips1.com/2014/02/01/autolisp-rotate-multiple-objects-around-their-base-point/

  • Like 1
Link to comment
Share on other sites

Only question would be "select relevant blocks"

 

1 So question is how ? I would suggest pick so get name, could do multi pick. ssget blk1,blk2,blk3

 

2 As insert point is on pline it is possible to get pline or line etc (setq ent2 (ssname (ssget pt ) 0)) the pt being insertion point

 

3 Yes can get the 1stderivative and then the angle at the point.

 

4 Update block angle

 

Its all out there search the keywords. 

use dumpit so can look at properties of a objectDumpIt.LSP

 

 

 

Link to comment
Share on other sites

22 hours ago, guran said:

It seems like all you have to do is rotate all the blocks 90 degrees .
https://autocadtips1.com/2014/02/01/autolisp-rotate-multiple-objects-around-their-base-point/

Thank you, this will be useful for a set of particular blocks that always insert under 90°, however this was more of an error with my communication - the blocks sometimes get inserted under non-common angles...

Edited by Janouren
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...