Align blocks center

Align blocks center

StanThe
Enthusiast Enthusiast
1,340 Views
8 Replies
Message 1 of 9

Align blocks center

StanThe
Enthusiast
Enthusiast

I got a lisp routine from this forum that will align a multitude of blocks down the left side

without regard to any text. I need it to align down the center of the blocks like the picture i've included.

I've manipulated the lisp to only do this vertically and i don't remember who gave this to me to 

begin with but thank you!!!

SH
0 Likes
1,341 Views
8 Replies
Replies (8)
Message 2 of 9

dlanorh
Advisor
Advisor
The lisp is by pBe. What decides the vertical alignment x coord?

I am not one of the robots you're looking for

0 Likes
Message 3 of 9

StanThe
Enthusiast
Enthusiast

When i dug into this lisp and wrote the notes about what each part does i could've told you about the "x" but it's been too long.

I don't understand the lambda and that's probably the part that needs changed.

SH
0 Likes
Message 4 of 9

StanThe
Enthusiast
Enthusiast

If anyone has a different way to align the polyline part of the blocks down the center that would be great too!

SH
0 Likes
Message 5 of 9

ВeekeeCZ
Consultant
Consultant

We could kindly ask the author himself @pbejse if he has some time to make the adjustment.

0 Likes
Message 6 of 9

StanThe
Enthusiast
Enthusiast

Thank you! Message sent!

SH
0 Likes
Message 7 of 9

Kent1Cooper
Consultant
Consultant

@StanThe wrote:

.... I've manipulated the lisp to only do this vertically ....


 

Without having studied the whole thing in detail, I did notice something that could give you trouble:

 

I expect this [in the "VERTICAL OR HORIZONTAL" area]:

  (setq opt V)

 

should really be setting it as a text string:

  (setq opt "V")

Kent Cooper, AIA
0 Likes
Message 8 of 9

StanThe
Enthusiast
Enthusiast

If someone could explain the "lambda" parts to me or direct me where to look (Lambda for Dummies???  lol) i can figure this out. Please!

SH
0 Likes
Message 9 of 9

Kent1Cooper
Consultant
Consultant

@StanThe wrote:

If someone could explain the "lambda" parts to me or direct me where to look (Lambda for Dummies???  lol) i can figure this out. Please!


[This shouldn't have been in reply to me, but in any case....]

 

Admittedly Help about the (lambda) function is perhaps too terse, but as it says there, it's a way to define a function right where it is to be used, without having to give it a name as you would with (defun).  It takes some getting used to, but I'll try to explain one of its uses in that code, namely:

 

(setq

  points (mapcar '(lambda (n) (list (car n) (cadr n) 0.0)) points)

)

 

This takes a list of points [here in the 'points' variable] and converts it to a list in which all the points have the same X and Y coordinates they started with, but all have Z=0.0.  Broken out:

 

(mapcar  ;; apply following function across all items in list argument after function definition

  '(lambda  ;; open function definition

    (n)  ;; argument: stand-in within function for item from source list

    (list  ;; make a [in this case, point-coordinates] list of:

      (car n)  ;; X coordinate pulled from source item's point list

      (cadr n)  ;; Y coordinate pulled from source item's point list

      0.0  ;; Z coordinate the same for all, regardless of source's Z coordinate

    ); list

  ); lambda  ;; end function definition

  points  ;; list to apply function across

); mapcar

 

This (mapcar) function employing that (lambda) function returns the converted list of points, with all points forced into the drawing plane at Z=0 [in this case replacing  the original list, since the surrounding (setq) function uses the same variable name for the replacement as for the original].

Kent Cooper, AIA
0 Likes