Visual LISP, AutoLISP and General Customization

## Visual LISP, AutoLISP and General Customization

Valued Contributor
Posts: 92
Registered: ‎03-02-2010
Message 1 of 3 (615 Views)

# 3D Block rotation / orientation

615 Views, 2 Replies
05-24-2011 10:48 AM

What I am trying to do is calculate the other side of the rectangular block given these values.

I can get the "Normal" property, Insertion Point, and "Rotation" property of a rectangular block in 3 space. I can also use the "XScale" property to get its length. If someone could give me some example code they have for calculating something like this, I would really appreciate it.

I would already be done except the rotations in AutoCAD are wierd. I have found that if the block is rotated about the y axis of WCS at all the zero rotation is where the block lies on the x,y plane.

I'm trying to figure out how to calculate the rotational offset due to object coordinate system. There must be an easier way.

J

*Expert Elite*
Posts: 4,807
Registered: ‎09-13-2004
Message 2 of 3 (610 Views)

# Re: 3D Block rotation / orientation

05-24-2011 11:18 AM in reply to: jcourtne

I think a sample drawing or an image would help.

Is the Block 2- or 3-dimensional?  I assume from your saying you can get the length from the X scale that it's a unit-sized Block in its base definition, presumably either a 1x1 square or a 1x1x1 cube.  Is its insertion point at a corner [and if so, which one?], or in the middle, or....?

What do you mean by "the other side" of the rectangle Block?  In the case of one rotated only about the Y axis, and assuming a 2D rectangle with its insertion point is at the lower left, are you looking for the WCS X and Z coordinates of its right edge?  Or some point location in 3D, perhaps the upper right corner [opposite the insertion point]?

Might its bounding box tell you what you want to know?  That will identify the extents of it in all three directions.

Kent Cooper
Valued Contributor
Posts: 92
Registered: ‎03-02-2010
Message 3 of 3 (598 Views)

# Re: 3D Block rotation / orientation

05-25-2011 05:54 AM in reply to: jcourtne

I have an example attached.

These represent cable trays. Look at the white end of the rectangle shapes. I'm trying to write a lisp routine where the user clicks the ends of the trays they want to move, then clicks the point where they are supposed to attach.  In this case, all the tray except the top should be shorter by some amount.  However, the insertion point of the block might be the high side of that rectangle, meaning the tray would have to move if it were getting longer.  Also, when the trays are vertically stacked and not staggard, they want to be able to stretch all the trays at one time and not change in the z direction. Here is what I have currently.

Recently Solved