Jump to content

Get list of LineTypes in dwg


ziele_o2k
 Share

Recommended Posts

This solution work form me, but maybe I'm missing something?

(vlax-for #item (vla-get-LineTypes (vla-get-ActiveDocument (vlax-get-acad-object)))
    (if (and
            (not (wcmatch (strcase (vla-get-name #item)) "BYBLOCK,BYLAYER"))
            (= (logand (cdr (assoc 70 (entget (vlax-vla-object->ename #item)))) 16) 0)
        )
        (setq line_types_in_drawing (cons (strcase (vla-get-name #item)) line_types_in_drawing))
    )
)

 

Link to comment
Share on other sites

You could iterate with vanilla, without having to reconvert every definition:

(while (setq d (tblnext "LTYPE" (not d)))
  (if (= 0 (logand (cdr (assoc 70 d)) 16))
    (setq L (cons (cdr (assoc 2 d)) L))
  )
)
(= (length L) (length line_types_in_drawing)) >> T

 

Link to comment
Share on other sites

Another?

(vlax-for #item (vla-get-LineTypes (vla-get-ActiveDocument (vlax-get-acad-object)))
    (if (and
            (snvalid (setq n (strcase (vla-get-name #item))))
            (not (wcmatch n "BYBLOCK,BYLAYER"))
        )
        (setq L (cons n L))
    )
)

 

Link to comment
Share on other sites

39 minutes ago, Lee Mac said:

The snavalid test is redundant - if the linetype already exists, the name must be valid.

The snvalid function is used to check for xref-dependent linetypes.

(defun test ( / lst)
  (vlax-for obj (vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object)))
    (if (not (wcmatch (strcase (vla-get-name obj)) "*|*,BYBLOCK,BYLAYER"))
      (setq lst (cons (vla-get-name obj) lst))
    )
  )
  (reverse lst)
)

 

Edited by Roy_043
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
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.

 Share

×
×
  • Create New...