Author Topic: Educate me please - Extrusion Direction DXF code 210  (Read 9114 times)

0 Members and 1 Guest are viewing this topic.

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« on: October 27, 2004, 03:52:22 PM »
I have a block that has an X scale of something other than 1 that is inserted with a "compound" rotation angle not only is it rotated IN the XY plane, but also FROM the XY plane.  

IMAGE

Entity data is as follows:
Code: [Select]
Command: gtt
N Select Element For Association list((-1 . <Entity name: 40a7eed8>) (0 .
"INSERT") (330 . <Entity name: 40a7ecf8>) (5 . "5B") (100 . "AcDbEntity") (67 .
0) (410 . "Model") (8 . "0") (100 . "AcDbBlockReference") (2 . "W8X31-C") (10
-0.436124 -4.47634 4.47634) (41 . 1.0) (42 . 1.0) (43 . 36.0) (50 . 0.0) (70 .
0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.5 0.5 0.707107))


I want to move the block a given distance (say 6") in the same direction of it's compound rotation (the green arrow in the "IMAGE" above).  Now I think I can hack up enough stuff using DXF 210, to do what I want, but I'm just wondering if there isn't a much better way using some VLA function or other.  Throw an old dog a bone, and I'll appreciate the help.

David Bethel

  • Swamp Rat
  • Posts: 656
Educate me please - Extrusion Direction DXF code 210
« Reply #1 on: October 27, 2004, 04:07:18 PM »
A couple rugular ( reads David doesn't use VL ) ways I can think of;

Code: [Select]
(command "_.UCS" "_E" ename)
(command "_.MOVE" ename "" '(0 0) (list 0 6))
;;;It looks like a Y axis is where you want to go
(command "_.UCS" "_P")


Or you could use a combination of (trans) and (polar) and then (entmod) the insertion point.

-David
R12 Dos - A2K

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #2 on: October 27, 2004, 04:26:27 PM »
Quote from: David D Bethel
A couple rugular ( reads David doesn't use VL ) ways I can think of;

Code: [Select]
(command "_.UCS" "_E" ename)
(command "_.MOVE" ename "" '(0 0) (list 0 6))
;;;It looks like a Y axis is where you want to go
(command "_.UCS" "_P")


Or you could use a combination of (trans) and (polar) and then (entmod) the insertion point.

-David
I planned on using ENTMOD, I avoid diddling with the UCS if I can help it.  I don't think POLAR is gonna help, doesn't it return just the angle in the XY plane?

When you first look at the extrusion vector in the entity codes it does look like a translation in the Y axis, but it is really the Z axis of the block.  That's where I need the pickaxe to hack through what's going on.  I was kinda hoping for a VLA-THINGAMABOB to just spit it out for me.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Educate me please - Extrusion Direction DXF code 210
« Reply #3 on: October 27, 2004, 04:47:35 PM »
If you are going to use ENTMOD, why not grab the block reference insertion point (it is in WCS), use the TRANS function, converting it to the current UCS, calculate POLAR from that point, then TRANS that point back to the WCS and update the object...at least I think that is the way it should work
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

SMadsen

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #4 on: October 27, 2004, 04:58:01 PM »
Given a base point for movement pt, a direction vector dir and a moving distance dist, try this little snippet to get a target point for movement:

Code: [Select]
(defun offPoint (pt dir dist)
  (mapcar (function (lambda (a b) (+ (* dist a) (* dist b)))) pt dir)
)

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #5 on: October 27, 2004, 04:59:37 PM »
Quote from: Keith
If you are going to use ENTMOD, why not grab the block reference insertion point (it is in WCS), use the TRANS function, converting it to the current UCS, calculate POLAR from that point, then TRANS that point back to the WCS and update the object...at least I think that is the way it should work
But then I'd have to diddle with the UCS in the function, right?

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #6 on: October 27, 2004, 05:01:59 PM »
Quote from: SMadsen
Given a base point for movement pt, a direction vector dir and a moving distance dist, try this little snippet to get a target point for movement:

Code: [Select]
(defun offPoint (pt dir dist)
  (mapcar (function (lambda (a b) (+ (* dist a) (* dist b)))) pt dir)
)
hmmm... the "dir" is a translation in X,Y AND Z from WORLD ucs, right?

SMadsen

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #7 on: October 27, 2004, 05:17:36 PM »
In your case it would be the direction vector, (cdr (assoc 210 elist)) - elist being the INSERT entity list you posted.
pt would be the point you want to move from and dist would be 6"

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Educate me please - Extrusion Direction DXF code 210
« Reply #8 on: October 27, 2004, 06:31:27 PM »
Quote from: CADaver
Quote from: Keith
If you are going to use ENTMOD, why not grab the block reference insertion point (it is in WCS), use the TRANS function, converting it to the current UCS, calculate POLAR from that point, then TRANS that point back to the WCS and update the object...at least I think that is the way it should work
But then I'd have to diddle with the UCS in the function, right?


Nope ... you would not have to "diddle" with the UCS ... you should be able to trans the point to the object UCS using
(trans pt 0 ob_name)

and go from there....
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #9 on: October 27, 2004, 06:58:13 PM »
Quote from: SMadsen
In your case it would be the direction vector, (cdr (assoc 210 elist)) - elist being the INSERT entity list you posted.
pt would be the point you want to move from and dist would be 6"
Okay, that one hurt... what does an aneurism feel like?  I think I got it,  must   go    play,      post      back         la t  e   r  . . . . .

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #10 on: October 27, 2004, 07:00:39 PM »
Quote from: Keith
Quote from: CADaver
Quote from: Keith
If you are going to use ENTMOD, why not grab the block reference insertion point (it is in WCS), use the TRANS function, converting it to the current UCS, calculate POLAR from that point, then TRANS that point back to the WCS and update the object...at least I think that is the way it should work
But then I'd have to diddle with the UCS in the function, right?


Nope ... you would not have to "diddle" with the UCS ... you should be able to trans the point to the object UCS using
(trans pt 0 ob_name)

and go from there....
ummmm.... current UCS is WORLD, how do I get (POLAR to work in the object's ucs?

there's blood leakin' from my left ear.......

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Educate me please - Extrusion Direction DXF code 210
« Reply #11 on: October 27, 2004, 08:51:55 PM »
Hmmmm.....I think you have made me blow a gasket now ... transforming matricies from vector coordinates to angular directions for use in polar calculations ... I'll have to cogitate on this for a bit ...... I recreated your block and I must say that I have not been successful without already knowing the point location....

I was able to tranform the known point to the OCS and entmod it to the correct position, BUT as you state ... How to use polar in an extrusion direction....

I like a challenge ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Educate me please - Extrusion Direction DXF code 210
« Reply #12 on: October 27, 2004, 09:08:58 PM »
Why can't you use the MOVE command with the transformed points?
You would not have to mess with the UCS if you use transform, right?
Has it got to be entmod?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CADaver

  • Guest
Educate me please - Extrusion Direction DXF code 210
« Reply #13 on: October 27, 2004, 09:52:59 PM »
Quote from: CAB
Why can't you use the MOVE command with the transformed points?
You would not have to mess with the UCS if you use transform, right?
Has it got to be entmod?
No it doesn't, but I've been brain-washed (well skull-rinsed anyway) into avoiding (COMMAND.  

Considering my left pupil is fixed and blown, I am quite open to it at this point on a Wednesday night.

I almost thought I almost had it close with Stig's "OFFPOINT" function, but I've screwed it up somewhere.  Not sure enough grey matter remains oxygenated for me to understand it.

Well the ambulance has finally arrived, I'll try again tomorrow.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Educate me please - Extrusion Direction DXF code 210
« Reply #14 on: October 27, 2004, 10:20:00 PM »
CAB, the whole problem is not so much creating the point in the correct UCS, you can easily transform a point from UCS to OCS with trans,  the problem comes in when trying to determine effectively the angle at which you need to polar the point to....to get the point to transform.....

You want to move from pt1 to pt2 ...pt1 is known as the insertion point of obj, pt2 must be obtained from an offset of 6 in a direction vector of an unknown UCS system. The real problem is determining the angle at which the object is from the WCS XY plane.

Essentially what angle (as required by polar) would you use if all you know is the direction vector of (0.5 0.5 0.707107) ....
that is the real problem....
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie