Jump to content

Recommended Posts

Posted

Hey there,

I'm have a long span of conduits in this tunnel and need to label each of the conduits its 3-4 digit assignment in each viewport of each page. I made a center line to each of these conduits in the layer named that 3-4 digit code (ex, Centerline of ET23 is in layer ET23).

 

Does anybody know a way to make a leader that will just tell me the layer of the object (centerline) I attach it to? Or does anybody simple know a way to label the layer of an object?

 

Thanks for the help!

Posted
(defun c:Test (/ pt ss ent)
 (vl-load-com)
 (cond
   ((not (setq pt (getpoint "\nSpecify point on object: "))) nil)
   ((not (setq ss (ssget pt))) (alert "Point must be on object!"))
   (T
    (setq ent (entlast))
    (vl-cmdf "_.mleader" "_non" pt PAUSE)
    (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (vl-cmdf ""))
    (if (not (equal ent (setq ent (entlast))))
      (progn
        (vla-put-textstring
          (vlax-ename->vla-object ent)
          ;;(cdr (assoc 8 (entget (ssname ss 0))))
          (strcat "%<\\AcObjProp Object(%<\\_ObjId "
                  (if (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
                    (vlax-invoke-method
                      (vla-get-utility
                        (cond (*AcadDoc*)
                              ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
                        )
                      )
                      'GetObjectIdString
                      (vlax-ename->vla-object (ssname ss 0))
                      :vlax-false
                    )
                    (itoa (vla-get-objectid (vlax-ename->vla-object (ssname ss 0))))
                  )
                  ">%).Layer>%"
          )
        )
        (vla-regen *AcadDoc* acActiveViewport)
      )
    )
   )
 )
 (princ)
)

Posted

How do I use this code? Is it a LISP? And if so, What is the activation command?

 

Thanks

Posted

Thanks, works great. I know a bit about LISP Routines, but still not familiar with coding; so I couldn't quite identify the syntax. Thanks again for saving me hours!

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...