BIGAL Posted August 7, 2020 Posted August 7, 2020 (edited) I need some help, I am working on something I need to use trans. 1st up it all works in Bricscad but not in Autocad. Within a layout I am getting a point from modelspace but need its co-ordinates in paperspace, so drawing line work. I have a viewport with rotated view, via viewport get its center point world co-ords then use (trans pt 0 3) to work out point in pspace. To test just getpoint in a model space view, then use trans should return correct co-ords, I am sure its something simple maybe a variable not set. This is rough test by eye in Bricscad actual program is correct linework. Mspace (setq pt (getpoint)) (248.0 121.0 0.0) : (trans pt 0 3) (114.671115898589 91.2742053827904 0.0) : ._PSPACE : id Select point to identify coordinates: X=114 Y=90 Z=0 Can not provide all code as unsure of copyright at this stage. (setq cen (vlax-get obj 'Center )) (setq ht (vlax-get obj 'Height)) (setq wid (vlax-get obj 'Width)) (setq sc (vlax-get obj 'customscale )) (setq ang (vlax-get obj 'TwistAngle)) (command "._MSPACE") (setq vc (getvar "VIEWCTR")) (command "._PSPACE") (trans vc 0 3) the issue seems to be with Autocad and view center Command: _.MSPACE Command: (setq vc (getvar "VIEWCTR")) (811.989 -184.058 0.0) Command: (*Cancel* Command: _.PSPACE Command: (trans vc 0 3) (811.989 -184.058 0.0) this should be like 400 300 Edited August 7, 2020 by BIGAL Quote
dlanorh Posted August 7, 2020 Posted August 7, 2020 (trans pt "from" "to") IIRC you can only use trans ("to" = 3) with ("from" = 2) so perhaps (trans vc 2 3) and/or (setq vc (trans (getvar 'viewctr) 0 2)). Not really my strong point so can't be any more helpful. Quote
marko_ribar Posted August 7, 2020 Posted August 7, 2020 Not sure, but from my experience, I think you should use trans in the way it converts WCS to DCS and then DCS to PCS... I think I saw this somewhere from Gilles (gile)... It goes something like this : (trans (trans pt 0 2) 2 3) Not sure for all this but try it... HTH. Quote
BIGAL Posted August 8, 2020 Author Posted August 8, 2020 Thank for responding. The task was do a grid in pspace the model is a rotated view grid reflects real world co-ordinates. I did get it to work used. (setq psnewcen (trans (trans newcen 1 2) 2 3)) and reverse (setq startw (trans (trans start 3 2) 2 1)), the issue is you must be in the correct space Mspace in the viewport. It was interesting Bricscad just worked with 0 3. I will amend the code as I will remove the need for the pspace to model, trans as I was retrieving a X or Y so can use a + X spacing. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.