Sweety Posted August 26, 2010 Posted August 26, 2010 Hello friends . Could somebody explain to me the differences between the UCS and WCS please .... ? In particular the (trans '(0 0 0) 0 1) and (trans '(0 0 0) 1 0). So what 's the benefit or the needs of transforming of them ? Thanks ............. Sweety :wink: Quote
BlackBox Posted August 26, 2010 Posted August 26, 2010 Could somebody explain to me the differences between the UCS and WCS please .... ? User Coordinate System (UCS) World Coordinate System (WCS) Typically, when I translate a point it is because my current view (._plan command) has been rotated about the vicinity of my project I am working. As I work in Civil, specifically transportation, I frequently rotate my view to orient my drawings accordingly. That said, the translation is needed because my UCS has also been rotated to suite my current view, i.e., UCS Origin = (1094244.1235 480068.6858 0.0000), and WCS Origin = (0 0 0) So what 's the benefit or the needs of transforming of them ? A benefit if having the ability to translate a coordinate into another coordinate system. Obvious, I know, so here's an example: No matter what your UCS is set to, the vlax-curve-getstartpoint function returns a coordinate in the WCS. Being able to translate this WCS point into your current UCS is of great advantage. Hope that helps! Quote
Sweety Posted August 26, 2010 Author Posted August 26, 2010 *** THANKS RENDERMAN *** I have a small question please . I rotate the ucs ( X 180 degrees ) and inserted a text with these informations , and it is inserted normally ; (command "_.text" (trans '(0 0 0) [color="red"][b]0 1[/b][/color]) "" "" "this is a text") And I inserted another text as following , and it is also normal. (command "_.text" (trans '(0 0 0) [color="red"][b]1 0[/b][/color]) "" "" "this is a text") BUT when I went back with the UCS to World , I mean as the default ucs of Autocad, the above two texts are rotated 180 degrees . I am sorry, I could not understand the use of TRANS function. Any small hint once again please. Appreciated. Quote
David Bethel Posted August 26, 2010 Posted August 26, 2010 You wont see any difference when transforming point 0 0 0. It is always 0 0 0. Try any other point value. You also wont see a difference if the current UCS is WCS. -David Quote
Sweety Posted August 26, 2010 Author Posted August 26, 2010 Thanks DAVID, So what is the sensetive situation that I have to use TRANS with it ? Regards. Quote
BlackBox Posted August 26, 2010 Posted August 26, 2010 You're welcome. So if I understand you correctly... You have a drawing (right-side up) You rotate the UCS 180 degrees (upside down) Place some text (also upside down) Then rotate the drawing back 180 degrees (making the drawing right-side up again) ...and now your text is upside down...? Seemingly simple solution, don't rotate your UCS before making the text. :wink: As for the trans function, let's try this example... If you wanted to insert some text at the start point of a line, and used vlax-curve-getstartpoint to get the coordinates for that point, but your UCS was rotated 90 degrees, and it's origin was displaced from the WCS origin, then inserting text at the coordinates returned from the vlax-curve-getstartpoint function (in WCS) would result in a text object off in space somewhere. Whereas, if you use (trans (vlax-curve-getstartpoint vla-obj) 0 1) your WCS insertion point, would now be converted to your current UCS (exactly where you specified). I hope that wasn't too confusing for you? If so let me know and I'll see if I can come up with a simpler example for you. Quote
Sweety Posted August 26, 2010 Author Posted August 26, 2010 Thank you sweet hearted Renderman. Actually I rotated the drawing to see the conflict or the changes between UCS and WCS , But I was disappointed. Your last description is very advanced to me to get it well .I mean I am intermediate with Lisp so far. Just I would like to know, What is the sensetive situation that I have to use TRANS with it ? Many Many thanks. Sweety Quote
Lee Mac Posted August 26, 2010 Posted August 26, 2010 Here is a good read: http://www.theswamp.org/index.php?topic=13526.0 Also some info in this thread: http://www.cadtutor.net/forum/showthread.php?51628-entmake-continouse-line-example As a very quick example of the consequences of not using trans, try each of these: (defun c:notrans ( / p1 p2 ) (command "_.ucs" "_W" "_.ucs" "_Z" 35) (if (and (setq p1 (getpoint "\nSelect First Point: ")) (setq p2 (getpoint "\nSelect Second Point: " p1)) ) (entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2) ) ) ) (princ) ) (defun c:withtrans ( / p1 p2 ) (command "_.ucs" "_W" "_.ucs" "_Z" 35) (if (and (setq p1 (getpoint "\nSelect First Point: ")) (setq p2 (getpoint "\nSelect Second Point: " p1)) ) (entmake (list (cons 0 "LINE") (cons 10 (trans p1 1 0)) (cons 11 (trans p2 1 0)) ) ) ) (princ) ) Quote
BlackBox Posted August 26, 2010 Posted August 26, 2010 Thank you sweet hearted Renderman. No I'm NOT! (shhh... or everyone will find out!) Here is a good read: http://www.theswamp.org/index.php?topic=13526.0 Also some info in this thread: http://www.cadtutor.net/forum/showthread.php?51628-entmake-continouse-line-example Thanks for the good info Lee! Quote
Sweety Posted August 26, 2010 Author Posted August 26, 2010 Here is a good read:http://www.theswamp.org/index.php?topic=13526.0 Also some info in this thread: http://www.cadtutor.net/forum/showthread.php?51628-entmake-continouse-line-example As a very quick example of the consequences of not using trans, try each of these: Wow GREAT. That exactly was what I am looking for to know. * The second routine is performing as well as we expect while intending to insert points . * The first routine is taking my inserted points a way from me. . So the inserted points would transform the points to the angular degree of the current UCS without taking the consideration of points' insertion clicks . Am I right ? *** LEE with your two routines I got it very well *** Thank you soooooo much. Greatly appreciated. Quote
Lee Mac Posted August 26, 2010 Posted August 26, 2010 So the inserted points would transform the points to the angular degree of the current UCS without taking the consideration of points' insertion clicks . Not quite - The selected points have coordinates relative to the UCS (User Coordinate System), whereas, the endpoints of the line entity must be defined in WCS (or perhaps OCS for other entities such as LWPolyline). Hence we must transform the UCS points to be relative to the WCS. This can be done either by use of a relevant transformation matrix if we know the UCS rotation, normal and displacement - or via the trans function. Lee Quote
Sweety Posted August 26, 2010 Author Posted August 26, 2010 Allright, now things are setteled quitely. Thank you so much guys. Sweety Quote
alanjt Posted August 26, 2010 Posted August 26, 2010 You're very welcome Sweety. :lol:Sweet[ie] Quote
seakone Posted December 6, 2021 Posted December 6, 2021 I ment something like this. Any objection, Lee? (defun C:DrawScreenExtentPoints ( / extents) (setq extents (DS:ScreenExtents)) (foreach n extents (point n)) (princ) ) (defun DS:ScreenExtents ( / ang p_mid normal p_upperright p_lowerleft) (setq ang (- 90.0 (getb (nth 0 (getvar 'screensize)) (nth 1 (getvar 'screensize)))) p_mid (trans (getvar 'viewctr) 1 0 T) normal (trans '(0.0 0.0 1.0) 2 0 T) p_upperright (3dpolar p_mid (dtr ang) (pytc (* (/ (/ (getvar 'viewsize) 2.0)(nth 1 (getvar 'screensize))) (nth 0 (getvar 'screensize))) (/ (getvar 'viewsize) 2.0)) normal) p_lowerleft (3dpolar p_mid (dtr (+ 180.0 ang)) (pytc (* (/ (/ (getvar 'viewsize) 2.0)(nth 1 (getvar 'screensize))) (nth 0 (getvar 'screensize))) (/ (getvar 'viewsize) 2.0)) normal)) (list p_upperright p_lowerleft) ) (defun 3dpolar ( bpt ang dis nor ) (trans (polar (trans bpt 0 nor) ang dis) nor 0) ) (defun dtr (d) (* pi (/ d 180)) ) (defun Point (pt) (entmakex (list (cons 0 "POINT") (cons 10 pt)))) (princ) 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.