Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get a Point of a Model Space Object from Paper space

18 views
Skip to first unread message

Cristian Leon

unread,
Oct 28, 2004, 10:28:00 AM10/28/04
to
Hello

I'm developing a lisp program that works with a 3D piping design, and i need to dimension an isometric view. It's supposed that with the system variable dimassoc = 2 the dimensions take the real value from model space, but only works with orthogonal views...

The question is... is there a lisp function that retrieves the world coordinates of an object in model space being in paper space?

(i tried with (trans [point] 3 2) but it doesn't works whit the world coordinates and i can't relate with it)

thanks

Cristian Leon
Chile

James Allen

unread,
Oct 28, 2004, 4:09:48 PM10/28/04
to
Hi Cristian. Perhaps you can glean from this code what you need?
--
James Allen, EIT
Malicoat-Winslow Engineers, P.C.
Columbia, MO

;;; Draws a line in paperspace between two points picked in modelspace.
;;; No error checking included.
;;; Assumes that you will already be "in" a pviewport.
;;; For demonstration purposes only.
(defun c:test (/ doc p1 p2 ht)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
p1 (getpoint "\nPick a point. ")
p2 (getpoint "\nPick another point. ")
p1 (trans p1 1 2) ;From model UCS to pviewport DCS
p2 (trans p2 1 2) ;From model UCS to pviewport DCS
;; Correct z-value for pviewport target height
ht (vlax-get (vla-get-ActivePViewport doc) 'Target)
ht (list 0 0 (last ht))
p1 (mapcar '+ p1 ht)
p2 (mapcar '+ p2 ht)
p1 (trans p1 2 3) ;From pviewport DCS to paper DCS
p2 (trans p2 2 3) ;From pviewport DCS to paper DCS
)
(vla-put-MSpace doc :vlax-False)
(setq ;; Correct z-value for paper target height
ht (vlax-get (vla-get-ActivePViewport doc) 'Target)
ht (list 0 0 (last ht))
p1 (mapcar '+ p1 ht)
p2 (mapcar '+ p2 ht)
p1 (trans p1 2 1) ;From paper DCS to paper UCS
p2 (trans p2 2 1) ;From paper DCS to paper UCS
)
(command "line" p1 p2 "")
)

"Cristian Leon" <nos...@address.withheld> wrote in message
news:1933703.109897371...@jiveforum2.autodesk.com...

Cristian Leon

unread,
Oct 29, 2004, 6:18:37 PM10/29/04
to
Hi:

It wasn't what exactly i need, but was very useful, i could make some changes that helps me.

One thing... i didn't understood what means the second part of the program:

(setq ;; Correct z-value for paper target height
ht (vlax-get (vla-get-ActivePViewport doc) 'Target)
ht (list 0 0 (last ht))
p1 (mapcar '+ p1 ht)
p2 (mapcar '+ p2 ht)
p1 (trans p1 2 1) ;From paper DCS to paper UCS
p2 (trans p2 2 1) ;From paper DCS to paper UCS
)


because i probe your program without this part and i get the same result...

Thanks a lot

Cristian Leon
Chile

James Allen

unread,
Oct 29, 2004, 7:07:31 PM10/29/04
to
> (setq ;; Correct z-value for paper target height
> ht (vlax-get (vla-get-ActivePViewport doc) 'Target)
> ht (list 0 0 (last ht))
> p1 (mapcar '+ p1 ht)
> p2 (mapcar '+ p2 ht)
>)
This part corrects for z value in the target. In my testing in A2k2, trans
was returning points with z values equal to the target z value. If you took
this part out and the viewport target had any z value, then the resulting
point would also have that z value.

> (setq p1 (trans p1 2 1) ;From paper DCS to paper UCS


> p2 (trans p2 2 1) ;From paper DCS to paper UCS
> )

This part allows for a non-world paper space ucs. In other words, if
(really big if I think) your paper space ucs is non-world, then this will
allow it to still return the correct point.

If your viewports target z value value equals zero and the paper space ucs
equals wcs, then none of the second portion has any effect. I put it in to
try to allow for any possibility. I am glad it was helpful.


--
James Allen, EIT
Malicoat-Winslow Engineers, P.C.
Columbia, MO

"Cristian Leon" <nos...@address.withheld> wrote in message
news:21976387.109908834...@jiveforum2.autodesk.com...

0 new messages