Align Blocks to line - lisp

Align Blocks to line - lisp

pukkalapoom
Participant Participant
1,044 Views
10 Replies
Message 1 of 11

Align Blocks to line - lisp

pukkalapoom
Participant
Participant

Hi

I searched lot for this activity but could not find. please do the needful

I placed several blocks in the drawing. But the problem is that these blocks are scattered around.

I want to have a lisp that will align these blocks so that they line up at the line.

Please see the attached picture. I have shown my current condition and how I want the results.

 

pukkalapoom_0-1711533998650.png

 

Thank you very much.

 

 

0 Likes
Accepted solutions (1)
1,045 Views
10 Replies
Replies (10)
Message 2 of 11

Kent1Cooper
Consultant
Consultant

You should be able to use something like >this<.  It puts them in a horizontal row, but could be adjusted for a vertical column.  See also Messages 19 and 24 in the same Topic, for different methods of selection.

Another possibility is BlockChart.lsp, >here<.

Kent Cooper, AIA
Message 3 of 11

Kent1Cooper
Consultant
Consultant

I found what could be a better one to use as a basis -- BlockChartInternal.lsp, >here<.  It's about Blocks in the drawing, not drawing files in a folder.  It also puts one of every Block defined into its chart, not based on User selection of existing objects, but its positioning aspect should be translatable easily enough.

Kent Cooper, AIA
Message 4 of 11

Sea-Haven
Mentor
Mentor

Maybe another, no error checks etc just Inserts at moment. Based on Insert point. As per image depends on location of insert point.

 

(defun c:wow ( / obj obj2 pt1 pt2)
(setq obj (vlax-ename->vla-object (car (entsel "\nSelect a object "))))
(setq ss (ssget '((0 . "Insert"))))
(if (= ss nil)
(alert "Incorrect objects selected")
(progn
(repeat (setq x (sslength ss))
(setq obj2 (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(setq pt1 (vlax-get obj2 'Insertionpoint))
(setq pt2 (vlax-curve-getclosestpointto obj pt1))
(vlax-put obj2 'Insertionpoint pt2)
)
)
)
(princ)
)

SeaHaven_0-1711673908493.png

 

Message 5 of 11

pukkalapoom
Participant
Participant

received with many thank. I will test and let you know for the feedback. 

0 Likes
Message 6 of 11

pukkalapoom
Participant
Participant
Accepted solution

Want to be able to set line spacing.

 1711705199973.jpg

Thank you very much.

0 Likes
Message 7 of 11

pbejse
Mentor
Mentor

@pukkalapoom wrote:

Want to be able to set line spacing.


From what point will the offset originate? from the lowest or topmost ? 

 

0 Likes
Message 8 of 11

Sea-Haven
Mentor
Mentor

Dont forget the angle answer, can see 2 variations at least horizontal and vertical.

0 Likes
Message 9 of 11

pukkalapoom
Participant
Participant

topmost

0 Likes
Message 10 of 11

pbejse
Mentor
Mentor

@pukkalapoom wrote:

topmost


In reference to @Sea-Haven's post about variations

Dont forget the angle answer, can see 2 variations at least horizontal and vertical.

 

Can you confirm for us if that variations exist? if Yes, what is the origin point for horizontal? Left most?

 

 

0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

I was thinking pick top of line then go down form 1st perp point, or for horizontal left or right end controls, then use angle of line for direction with Polar for points. Just busy at moment.

0 Likes