Jump to content

Need to Add a Variable to a LISP


PaulS00

Recommended Posts

Hello,

 

I have this LISP that matches C3D point properties, but doesn't include the point label rotation. As I was looking through the code, it seems that I could just add a line in, but I don't know what the specific "verbage" is.

 

Thoughts?

 

;;; 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)
)

Link to comment
Share on other sites

Using Visual LISP you can access most properties of objects (certain properties of pipe networks, profiles, etc. aren't accessible through LISP). You can access these functions via vlax-get-property, or the shortcut vla functions. For example

(vlax-get-property obj 'Layer)

or the shortcut function

(vla-get-layer obj)

. If the shortcut functions are available, it will turn blue in the Visual LISP Editor, type vlide at the command line to access.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...