I'm trying to make a LISP routine that will match point style, label style, marker rotation, label rotation and layer for a selected point to multiple other points. I don't know what the exact variable names are or how to find them.
See the post below for code that is similar too what I'm looking for.
I'm somewhat able to follow this code, just need a little boost. Thanks in advacne for any guidance towards the solution.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Assuming you have the point already that will be the 'source' point saved as 'sourcept':
(setq ptrotation (vlax-get sourcept 'rotation) lblrotation (vlax-get sourcept 'labelrotation) ptstyle (vlax-get sourcept 'Style) lblStyle (vlax-get sourcept 'LabelStyle) layr (vlax-get sourcept 'layer) ) ;;then for each point you want to apply these to: (vlax-put pt 'rotation ptrotation) (vlax-put pt 'labelrotation lblrotation) (vlax-put pt 'Style ptstyle) (vlax-put pt 'labelstyle lblstyle) (vlax-put pt 'layer layr)
Hi ,
You can find out the list of all the properties which you can access by referring to AeccPoint in Civil 3D COM API reference doc.
Thanks,
Hi Jeff,
I have tried to put these together and I just can't make the code to work. Your rotation tool is terrific.
If you can steer me in the right direction I would appreciate it.
Thanks
Allan
Hi Jeff
Any help is much appreciated. I am still learning lisp.
I am trying to match all point properties of a cogo point.
Guys in the field give random codes sometimes or errors and think it would be much quicker to have a match properties lisp.
From what I have gathered from previous posts I have put this together
;;; match point lable style
(defun c:mst (/ doc ss ss2 obj obj2 newstyle oldstyle)
(vl-load-com)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark doc)
(while (setq ss (ssget ":S" '((0 . "AECC_COGO_POINT"))))
(setq obj (vlax-ename->vla-object (ssname ss 0)))
(setq oldstyle (vlax-get obj 'labelstyle))
(setq oldstyle (vlax-get obj 'labelstyle newstyle))
(setq oldstyle (vlax-get obj 'Style ptstyle))
(setq oldstyle (vlax-get obj 'labelstyle lblstyle))
(setq oldstyle (vlax-get obj 'layer layr))
(princ "\n....select Points to change: ")
(if (setq ss (ssget '((0 . "AECC_COGO_POINT"))))
(while (> (sslength ss) 0)
(setq obj2 (vlax-ename->vla-object (ssname ss2 0)))
(setq newstyle (vlax-get obj2 'labelstyle))
(vlax-put obj 'labelstyle newstyle)
(vlax-put pt 'Style ptstyle)
(vlax-put pt 'labelstyle lblstyle)
(vlax-put pt 'layer layr)
(vla-endundomark doc)
(princ)
)
)
not sure if we can add raw description also?
Best Regards
Allan
Here's your code, Allan, modified to work correctly.
;;; match point lable style (defun c:mst (/ doc labelstyle layr lblstyle newstyle obj obj2 pt ptdesc ptlayer ptstyle sourcept ss ss2) (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (princ "\nSelect source point: ") (if (setq ss (ssget ":S" '((0 . "AECC_COGO_POINT")))) (progn (setq sourcePt (vlax-ename->vla-object (ssname ss 0))) (setq labelstyle (vlax-get sourcePt 'labelstyle)) (setq ptstyle (vlax-get sourcePt 'Style)) (setq ptdesc (vlax-get sourcePt 'rawdescription)) (setq ptlayer (vlax-get sourcePt 'layer)) (princ "\n....select Points to change: ") (if (setq ss (ssget '((0 . "AECC_COGO_POINT")))) (while (> (sslength ss) 0) (setq pt (vlax-ename->vla-object (ssname ss 0))) (vlax-put pt 'labelstyle labelstyle) (vlax-put pt 'Style ptstyle) (vlax-put pt 'rawdescription ptdesc) (vlax-put pt 'layer ptlayer) (ssdel (ssname ss 0) ss) ) ) ) ) (vla-endundomark doc) (princ) )
Jeff,
You are a legend. I will look at this monday. I REALLY apprecite your help.
Best regards
Allan
Thanks Jeff
How would one change this code so that a default point style or point label style would copy over from the source point?
Ian, unfortunately I have never found a way, in the COM API, to set the styles to the "<default>" property. Essentially, those points have no style assigned, but assigning the style to nil throws an error. Here's an old thread on the matter:
where it's discussing the VB.NET but they were using the COM API.
In the newer .NET API this can be done, but that leaves lisp out.
Jeff, could you modify this lisp to only match the rotation of the source?
Thanks ahead of time.
Hi Jeff,
This is a great routine. I am trying to modify it so I can use it to freeze the layer that the point label is on. Do you thing you could help me out?
Thanks!
@d_prontnicki wrote:
Hi Jeff,
This is a great routine. I am trying to modify it so I can use it to freeze the layer that the point label is on. Do you thing you could help me out?
Thanks!
Do you really want to freeze the label layer? Or, just turn off the display of the label in the Point Style setting? Either way, you will need to get the LabelDisplayStylePlan property from the PointStyle. Then you can get the Layer name or set the Visible property to false. Here are a few lines that can be added to the original code to do this:
(setq ptstyle (vlax-get sourcePt 'Style)) (setq lbldisplay (vlax-get ptstyle 'labeldisplaystyleplan)) (setq layername (vlax-get lbldisplay 'layer)) ;;add code to freeze that layer, or, just turn it off in the style. Turning it off in the style ;; would be best, as the marker and label may both be on the same layer and freezing the layer ;; would make the point invisible. (vlax-put lbldisplay 'visible 0);;this turns off the display of the label. (setq ptdesc (vlax-get sourcePt 'rawdescription))
Jeff,
Thank you so much! This helped tremendously! I really appreciate it.
@allanbsteven wrote:
Jeff,
You are a legend....
I second that.