Hello!
Objectif: Draw a rectangular box knowing center of two base, width and height:
Input:
- center point C1 = '(x1 y1 z1) of the first base
- center point C2 = '(x2 y2 z2) of the second base
- Width and Height.
As you know, BOX command asks for P1 P2 P3 and P4 points (see picture, red points), but for us the input we know are only Center1, Center2, Width and Height.
It's a geometric issue, but you may have idea to help...
Thanks!
Solved! Go to Solution.
Solved by komondormrex. Go to Solution.
Solved by paullimapa. Go to Solution.
I can get you partially there with a Square when Width=Height by using command:
POLYGON
4 sides
center is C1
Circumscribed option
Radius is Width or Height divided by 2
Then use the following command to create the BOX:
Extrude
Last
Direction
C1
C2
Your talking about a SOLID Box ? So you have distance between pt1 pt2 as the length so need width and extrusion height, so just do that use solid box command then do a rotate and move to the 2 points.
hey,
just box with width, height and depth
(setq center_point_1 '(-100. 150. 200.))
(setq center_point_2 '(300. -50. -400.))
(setq height 130.)
(setq width 50.)
;(command "_line" center_point_1 center_point_2 "")
(command "_rectang" "_non" (list (* -1 0.5 height) (* -1 0.5 width)) "_non" (list (* 0.5 height) (* 0.5 width)))
(setq profile_object (vlax-ename->vla-object (setq profile_ename (entlast))))
(setq divider (apply 'max (mapcar 'abs (mapcar '- center_point_1 center_point_2))))
(vla-put-normal profile_object (vlax-3d-point (mapcar '/ (mapcar '- center_point_1 center_point_2) (list divider divider divider))))
(vla-move profile_object (vlax-3d-point '(0 0 0)) (vlax-3d-point center_point_1))
(command "_extrude" profile_ename "" "_d" center_point_1 center_point_2)
Thank you for your time:
I did thoses steps:
-Command box - Center (Select midpoint of Center1-Center2) - Length (Insert my length = distance between center1 and center2) - Width (Insert my width) - Then, autocad asks to insert height or 2Points, I tried both height and 2Points, but can't draw the correct box.
Thanks.
You forgot the step before the Box command which is:
UCS
ZAxis
Center1
Center2
now do the Box command sequence then for height you can pick either Center1 or Center2
Yes all points now need to be entered in the current ucs or use lisp trans function to translate the coordinates from one ucs to another:
Can't find what you're looking for? Ask the community or share your knowledge.