CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 18174
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedLisp for Printing Points at Centroid of Polyline

 Post Reply Post Reply
Author
nkc_13 View Drop Down
Newbie
Newbie


Joined: 21.Apr.2019
Location: Hong Kong
Using: AutoCAD2018
Status: Offline
Points: 2
Direct Link To This Post Topic: Lisp for Printing Points at Centroid of Polyline
    Posted: 21.Apr.2019 at 18:22
I have found the relevant lisp by Gruru Lee Mac, however, there is error msg "Region is not on the UCS plane: popped out for some object and I found that can be solved by converting the UCS as the object before creating the point at centroid of the polyline by the Lisp. May I ask is it possible to include the UCS command in the Lisp for each object? Greatly appreciate if any Master can help!

(defun c:pc ( / acdoc acspc acsel reg ) (vl-load-com) ;; ? Lee Mac 2011

 (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))
       acspc (vlax-get-property acdoc (if (= 1 (getvar 'CVPORT)) 'Paperspace 'Modelspace))
 )
 (if (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))
   (progn
     (vlax-for obj (setq acsel (vla-get-ActiveSelectionSet acdoc))
       (vlax-invoke acspc 'addpoint
         (trans (vlax-get (setq reg (car (vlax-invoke acspc 'addregion (list obj)))) 'Centroid) 1 0)
       )
       (vla-delete reg)
     )
     (vla-delete acsel)
   )
 )
 (princ)
)


Also I find the command for converting the UCS 

(defun c:obrotucs ( )
(command "ucs" "ob" pause "plan"
"current")
(princ)
)
< x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back"> < x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back"> < x="0" y="0" width="99999" height="99999" id="hc_extension_off">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast">< x="0" y="0" width="99999" height="99999" id="hc_extension_highcontrast_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_grayscale_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_back">< x="0" y="0" width="99999" height="99999" id="hc_extension_invert_grayscale">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black">< x="0" y="0" width="99999" height="99999" id="hc_extension_yellow_on_black_back">

Edited by nkc_13 - 21.Apr.2019 at 18:28
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,289 seconds.