Author Topic: Q. about extrusion direction  (Read 3155 times)

0 Members and 1 Guest are viewing this topic.

Fuccaro

  • Guest
Q. about extrusion direction
« on: November 04, 2004, 02:14:55 AM »
I try to rotate a block around of the insertion point by changing the extrusion direction. If the block is in the origin -it is Ok. But if the block is inserted away it will rotate according to the new direction but also it will jump in a new location. Here is a piece of code. Please help.
Thank you
Code: [Select]

(defun test ()
  (setq ang1 (/ pi 10.0))
  (setq enl (entget (entlast)))
  (setq e (cdr (assoc 210 enl)))

  (setq ang (atan (caddr e)
(sqrt (+ (* (car e) (car e)) (* (cadr e) (cadr e))))
  )
  )
  (setq ang (+ ang ang1))
  (setq angor (angle '(0 0) (cdr (assoc 10 enl))))
  (setq z (cos ang))
  (setq x (* (sin ang) (cos angor)))
  (setq y (* (sin ang) (sin angor)))
  (setq f (subst (list 210 x y z) (assoc 210 f) f))
  (entmod f)
)

David Bethel

  • Swamp Rat
  • Posts: 656
Q. about extrusion direction
« Reply #1 on: November 04, 2004, 08:41:21 AM »
fuccaro,

I think I understand.  But I also think it is a no can do.

Try this:

new drawing

UCS _Z 90

Insert a block, rotated 180 degrees

The dxf data shows 210 @ 0,0,1 50 @ pi

UCS _W

Same data.  So by using DXF alone, you can't tell what the ucs rotation angle was at the time a insertion.  I don't think you can reverse engineer it.  -David
R12 Dos - A2K

SMadsen

  • Guest
Q. about extrusion direction
« Reply #2 on: November 04, 2004, 09:44:46 AM »
As I understand it, insertion point, rotation and extrusion make up for the OCS at the time of insertion. But I agree that it's not possible to tell what rotation and origin the UCS had - only which plane it described at the time (expressed by the extrusion).

Fuccaro, I'm not sure I understand what you are trying to accomplish. Do you simply want to rotate the block around the extrusion vector? I mean rotation in the plane that the block OCS describes?

Fuccaro

  • Guest
Q. about extrusion direction
« Reply #3 on: November 05, 2004, 03:32:17 AM »
IMAGE HERE
I have a block inserted in the point INS. The Z axis and the extrusion direction E are parallel.
I try to rotate the block to “turn its face from origin”. If P is the plane parallel with OZ and containing the origin and the insertion point, I try to rotate the block with angle ANG1. After the rotation the extrusion direction E1 must remain in the plane P.
Assuming that the length of E1 is 1, it will be projected on the Z axis:
 z=cos(ang1)
and on the XOY plane:
 pr=sin(ang1)
(pr does not appear explicitely in the lisp routine)

In the XOY plane:
 x=pr*cos(angor)
 y=pr*sin(angor)

ANGOR is the angle between PR and the OX

David Bethel

  • Swamp Rat
  • Posts: 656
Q. about extrusion direction
« Reply #4 on: November 05, 2004, 09:37:33 AM »
fuccaro,

I must admit, I'm a bit lost

Are you wanting to rotate around the INS -> E1 axis?  -David
R12 Dos - A2K

Fuccaro

  • Guest
Q. about extrusion direction
« Reply #5 on: November 08, 2004, 05:39:50 AM »
I try to rotate the block around the insertion point. The normal direction E will become E1 after the rotation.
Thank you for trying to help me.