Steve Johnstone Posted June 25, 2017 Share Posted June 25, 2017 In the past I have written codes that manipulate the geometry of a polyline however I have only recently come across the issue of OCS's. I wrote a code that extracts the polyline vertices and creates a table below indicating Chainages and RL's (Civil Engineering Sections). This code worked well until I found that in some cases the vertex coordinates were not the same as the UCS coordinates, hence I discovered the world of OCS. Does anyone have a lisp code that will convert the OCS coordinates into UCS, or advise the best way of doing it. Thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 25, 2017 Share Posted June 25, 2017 Your lucky day just had a play with the trans function you can convert a pt at User co-ords to world very simply. (setq wpt (trans ucspt 1 0)) Quote Link to comment Share on other sites More sharing options...
Steve Johnstone Posted June 25, 2017 Author Share Posted June 25, 2017 Thanks BigAl, but I need to convert OCS (Object Coordinate System) to UCS. Cheers Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted June 25, 2017 Share Posted June 25, 2017 You can use: (trans point_in_ocs normal_of_entity 1) or: (trans point_in_ocs ename_of_entity 1) (setq enm (car (entsel))) (setq elst (entget enm)) (setq elv (list (cdr (assoc 38 elst)))) ; Elevation. (setq nor (cdr (assoc 210 elst))) ; Extrusion or Normal. (vl-remove nil (mapcar '(lambda (sub) (if (= 10 (car sub)) (trans (append (cdr sub) elv) nor 1))) elst ) ) Quote Link to comment Share on other sites More sharing options...
Steve Johnstone Posted June 25, 2017 Author Share Posted June 25, 2017 Thanks for that Roy. I,ll give them a try into my code. Cheers Quote Link to comment Share on other sites More sharing options...
Steve Johnstone Posted June 26, 2017 Author Share Posted June 26, 2017 Thanks Roy I ended up using your 2nd code option. Everything worked well. Cheers Quote Link to comment Share on other sites More sharing options...
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.