Jump to content

Recommended Posts

Posted

Hello .

 

I wonder why the "entget" not getting all dxf codes that are related to layer list !

 

 (setq l (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object))
         )
 )
 (setq e (entget (vlax-vla-object->ename l)))

Which is return only the following list of dxf .

((-1 . ) (0 . "TABLE") (2 . "LAYER") (330 . ) (5 . "2") (100 . "AcDbSymbolTable") (70 . 3))

Thanks
  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    9

  • Tharwat

    9

  • Lee Mac

    4

Top Posters In This Topic

Posted

I wonder why you're looking at DXF layer data in such a screwy way.

Posted

You are stepping through the VL layer table to extract DXF information. Why not step through (tblnext) the AL (autolisp) layer table and get the info that way?

That's what's screwy.

Posted

Actually I find it the easiest way to get all Layer list with VL .

 

So I am trying to get a list of the locked , frozen or off layers only in a dwg .

Posted

Then step through the VL layer collection and just use VL functions vla-get-LayerOn, vla-get-Freeze, vla-get-Lock. Why complicate things by converting the object to an entity to attempt and extract data?

Posted

I think problems in understanding arise when beginners dive into Visual LISP before fully grasping vanilla AutoLISP.

 

/opinion

 

Anyway, as Alan says, use tblnext / tblsearch / tblobjname.

Posted
I think problems in understanding arise when beginners dive into Visual LISP before fully grasping vanilla AutoLISP.

Agreed......

Posted

Al right guys .

 

I looking to extract all layer names of a dwg . but how to get them without names being repeated ? :D

 

Thanks

Posted

tblnext through the layer table OR vlax-for through the layer collection.

Posted
I got no chance with tblnext !:glare:

Ugh, did you even look?

 

(defun layerNameList (/ d l)
 (while (setq d (tblnext "LAYER" (null d)))
   (setq l (cons (cdr (assoc 2 d)) l))
 )
 (acad_strlsort l)
)

Posted

8)

 

This is what I have been looking for . (null ......) :lol:

 

Thanks .

Posted

There are other ways to use tblnext

 

(defun TableNames ( table / _TableNames )

 (defun _TableNames ( a )
   (if a (cons (cdr (assoc 2 a)) (_TableNames (tblnext table))))
 )
 (_TableNames (tblnext table t))
)

Posted

That's really unique .

 

May I ask you about the process of the sub-routine ?

 

You are using the same sub-routine of the same sub-routine :?

 

e.g.

 (defun [color=red]_TableNames[/color] ( a )
   (if a (cons (cdr (assoc 2 a))
               ([color=red]_TableNames[/color] (tblnext table))))
 )
 ([color=red]_TableNames[/color] (tblnext table t))
)

 

Thanks a lot.

Posted
There are other ways to use tblnext

 

(defun TableNames ( table / _TableNames )

 (defun _TableNames ( a )
   (if a (cons (cdr (assoc 2 a)) (_TableNames (tblnext table))))
 )
 (_TableNames (tblnext table t))
)

Funny, I knew you were going to post that exact code structure. LoL

Posted
Research the term: 'Recursion' :)

 

It is a massive theme to read all or at least to get the point .:sweat:

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