PDA

View Full Version : a little help with TRANS


dkennard
2007-07-02, 04:02 AM
I'm tyring to place a donut in paper space on each vertex of a model space LWPOLYLINE.

Now I have extracted the 2d point data from the polyline but I'm having trouble with converting it into a valid point in my PS viewport.

say I ID a point in my model space (PT):
X = 193774534.7 Y = 7626413985.8 Z =0.0
and the same "point" in paper space:
X = 295.8 Y = 410.6 Z = 0.0

If I use trans to convert from UCS to DCS with:
(setq pt (trans (trans pt 1 2) 2 3))
I get (387342.0 1.5253e+007 0.0) which I was not expecting, should I have to account for the scale of my view port when transforming points?

Avatart
2007-07-02, 10:23 AM
I don't understand why you have the first TRANS in there, surely it would just be:
(setq pt (trans pt 2 3))

dkennard
2007-07-03, 02:40 AM
According to the AutoLisp documentation I have (VisualLISP help file) you can only use TRANS codes 2 and 3 with each other.

If I run the following test the translated points (pt2 pt3 and pt4) are all the same. so I'm still stuck :-(

(defun c:transtest ()
(command "mspace")
(setq pt1 (getpoint "nPick a point: "))
(command "pspace")
(setq pt2 (trans pt1 1 2))
(setq pt3 (trans pt1 2 3))
(setq pt4 (trans (trans pt1 1 2) 2 3 ))

(princ "n pt1=")
(princ pt1)
(princ "n TRANS pt1 1 2 =")
(princ pt2)
(princ "n TRANS pt1 2 3 =")
(princ pt3)
(princ "n TRANS pt1 2 3 =")
(princ pt3)
(princ "n (TRANS (TRANS pt1 1 2) 2 3) =")
(princ pt3)

(princ)
)

dkennard
2007-07-03, 07:16 AM
I don't understand why you have the first TRANS in there, surely it would just be:
(setq pt (trans pt 2 3))


Carl - you were right, the "test" drawing I'd selected had the xref, that contains the polyline data, inserted at the wrong base point.

Once I'd reinserted at the correct location (setq pt (trans pt 2 3)) does give me the correct Paper space coordinates.

Thanks for your help. :-)

Avatart
2007-07-03, 10:00 AM
Carl - you were right, the "test" drawing I'd selected had the xref, that contains the polyline data, inserted at the wrong base point.

Once I'd reinserted at the correct location (setq pt (trans pt 2 3)) does give me the correct Paper space coordinates.

Thanks for your help. :-)Not a problem squire, it's what we're for! :beer: