Tharwat Posted April 25, 2011 Posted April 25, 2011 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 Quote
alanjt Posted April 25, 2011 Posted April 25, 2011 I wonder why you're looking at DXF layer data in such a screwy way. Quote
Tharwat Posted April 25, 2011 Author Posted April 25, 2011 I do not know why you call it screwy way ? Quote
alanjt Posted April 25, 2011 Posted April 25, 2011 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. Quote
Tharwat Posted April 25, 2011 Author Posted April 25, 2011 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 . Quote
alanjt Posted April 25, 2011 Posted April 25, 2011 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? Quote
Lee Mac Posted April 25, 2011 Posted April 25, 2011 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. Quote
alanjt Posted April 26, 2011 Posted April 26, 2011 I think problems in understanding arise when beginners dive into Visual LISP before fully grasping vanilla AutoLISP. Agreed...... Quote
Tharwat Posted April 26, 2011 Author Posted April 26, 2011 Al right guys . I looking to extract all layer names of a dwg . but how to get them without names being repeated ? Thanks Quote
alanjt Posted April 26, 2011 Posted April 26, 2011 tblnext through the layer table OR vlax-for through the layer collection. Quote
alanjt Posted April 26, 2011 Posted April 26, 2011 I got no chance with tblnext ! 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) ) Quote
Tharwat Posted April 26, 2011 Author Posted April 26, 2011 This is what I have been looking for . (null ......) Thanks . Quote
Lee Mac Posted April 26, 2011 Posted April 26, 2011 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)) ) Quote
Tharwat Posted April 26, 2011 Author Posted April 26, 2011 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. Quote
alanjt Posted April 26, 2011 Posted April 26, 2011 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 Quote
Tharwat Posted April 26, 2011 Author Posted April 26, 2011 Research the term: 'Recursion' It is a massive theme to read all or at least to get the point . Quote
Recommended Posts
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.