Jump to content

How to get the linetype assigned to a layer


ILoveMadoka

Recommended Posts

Here are entity lists of 2 lines side by side.

One is Continuous on is Hidden.

You cannot tell which is which by what lisp returns.

If it returned the Assoc 6 value I'd be fine but it does not.

 

* List in AutoLISP format *((-1 . ) (0 . LINE) (330 . ) (5 . 571) (100 . AcDbEntity) (67 . 0) (410 . Model) (8 . 0) (100 . AcDbLine) (10 -60.0959 78.554 0.0) (11 -78.7209 78.554 0.0) (210 0.0 0.0 1.0))

Variable name is ENT

 

* List in AutoLISP format *((-1 . ) (0 . LINE) (330 . ) (5 . 573) (100 . AcDbEntity) (67 . 0) (410 . Model) (8 . DEFAULT_2) (100 . AcDbLine) (10 -60.0959 78.679 0.0) (11 -78.7209 78.679 0.0) (210 0.0 0.0 1.0))

Variable name is ENT

 

I need to know the code that will return the linetype assigned to a layer by selecting an entity. (The color too...)

Is this really simple?

I just don't know how to do it.

 

Help please!!

 

TIA!!

Link to comment
Share on other sites

the entity list does not return the linetype if it is bylayer. To obtain the linetype assigned to the layer, access the entity list of the actual layer of each line via

 

 
(setq layer_name (cdr (assoc 8 (entget (ent)))))

 

then

 

 
(setq layer_ltype (cdr (assoc 6 (tblsearch "LAYER" layer_name))))

Link to comment
Share on other sites

Also:

 

(defun getLT (lay)
 (vlax-for layer
       (vla-get-layers
         (vla-get-activedocument
       (vlax-get-acad-object)))
   (if (eq (vla-get-name layer) lay)
     (setq lt (vla-get-Linetype layer))))
 (princ (vl-princ-to-string lt)))

Link to comment
Share on other sites

How do I perform a get list of all the hidden lines in a drawing

if they are bylayer? Something along these lines...

 

(setq SS1 (ssget "X" (list (cons 6 "Hidden"))))

 

 

Thanks so much for all your help and expertise!!

Link to comment
Share on other sites

Perhaps:

 

(defun getLT  (lt)
 (setq lLst "")
 (vlax-for layer
          (vla-get-layers
            (vla-get-activedocument
              (vlax-get-acad-object)))
   (if    (eq (strcase (vla-get-Linetype layer)) (strcase lt))
     (setq lLst (strcat  (vla-get-name layer) (chr 44) lLst)))))



(defun c:test (/ lLst)
 (vl-load-com)
 (getLT "Hidden")
 (setq lLst (vl-string-right-trim (chr 44) lLst))
 (sssetfirst nil (ssget "X" (list (cons 8 lLst)
    (if (getvar "CTAB")(cons 410 (getvar "CTAB"))
      (cons 67 (- 1 (getvar "TILEMODE")))))))
 (princ))

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