Janouren Posted May 31, 2021 Share Posted May 31, 2021 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: 1 Quote Link to comment Share on other sites More sharing options...
guran Posted May 31, 2021 Share Posted May 31, 2021 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/ 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 31, 2021 Share Posted May 31, 2021 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 Quote Link to comment Share on other sites More sharing options...
Janouren Posted June 1, 2021 Author Share Posted June 1, 2021 (edited) 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 June 1, 2021 by Janouren Quote Link to comment Share on other sites More sharing options...
tombu Posted June 6, 2021 Share Posted June 6, 2021 Slightly modified version of Lee Mac's Text to Curve lisp: http://www.theswamp.org/index.php?topic=54837.msg592535#msg592535 Should do the trick. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.