+ Reply to Thread
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 40
  1. #11
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,602

    Default

    Quote Originally Posted by btraemoore View Post
    yes the Linetype and the color will match. No, I will be replacing the entire name.
    I don't get it. Say for instance on the layer collection you have two or three that have the same LINETYPE and COLOR , what will happen then?

  2. #12
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default

    Quote Originally Posted by btraemoore View Post
    yes the Linetype and the color will match. No, I will be replacing the entire name. Once I have the list narrowed down to the LT and color that match the existing layer, im thinking of having it compare the first character in both name variables and choose the correct layer name to save based off that or having it evaluate the total matching characters in the applicable layer names via strcat ascii, maybe...
    Code:
    (vl-load-com)
    	(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
    	(setq layertable (vla-get-layers acadDocument))
    	(repeat
    		(setq Lay (tblnext "LAYER" 1))
    		(while
    			(setq layLT (cdr (assoc 6 lay)) 
    				  layCOLOR (cdr (assoc 62 lay))
    				  layNM (cdr (assoc 2 lay))
    			);setq
    				(open C:\\Documents and Settings\\moorerb\\Desktop\\scripting-lisp\\standardlayers.txt "r")
    this is the coding that i have so far. I haven't figured a way to end the loop yet, and still reading on how to evaluate each line in the delimited file, TSV as delimiter

  3. #13
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default

    say i have 20 layers with the same LT and color, it will evaluate the name of the matching layer properties and if the first character of the layer in question matches the first character of one of the possible matches then it will save that name as the variable to change it to and if there are multiple matches then it will go down the line and compare the second character of the possible matches... so on and so forth, to get the most accurate name for the layer.

  4. #14
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,602

    Default

    Code:
     
    (while (setq a (tblnext "LAYER" (null a)))
          (setq coll  (list (cdr (assoc 6 a))
                                       (cdr (assoc 62 a))
                                       (cdr (assoc 2 a))))
          (print coll);<<<<--- Do your thing here
        )
    Can yu post here a part of that "standardlayers.txt" file

  5. #15
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default

    0 7 CONTINUOUS
    2 3 CONTINUOUS
    BLDG 2 CONTINUOUS
    BLDG 7 CONTINUOUS
    BORDER 5 CONTINUOUS
    BORDER 7 CONTINUOUS
    CENTER 2 CENTER
    CENTER 7 CENTER
    CLINE 7 CENTER
    CLINES 7 CENTER2
    COL 1 CONTINUOUS
    CONC 1 CONTINUOUS
    CONDUIT-HIDDEN 1 HIDDEN
    CONDUIT-HIDDEN 7 HIDDEN
    CONDUIT 1 CONTINUOUS
    CONDUIT 7 CONTINUOUS
    CONN 6 CONTINUOUS
    CONST 5 CONTINUOUS
    CONST 7 CONTINUOUS
    CONTROL 6 CONTINUOUS
    CONTROL 7 CONTINUOUS
    CPLPOVR 7 CONTINUOUS
    CPRT 4 CONTINUOUS
    CPRT 7 CONTINUOUS
    CUTLINE 5 HIDDEN
    CUTLINE 7 HIDDEN
    DASHED 2 DASHED
    DASHED 2 PHANTOM
    DASHED 7 PHANTOM
    DEFPOINTS 7 CONTINUOUS
    DEPT 3 CONTINUOUS
    DEPT 7 CONTINUOUS
    DIM 2 CONTINUOUS
    DIM 7 CONTINUOUS
    DIMN 1 CONTINUOUS
    DIMN 7 CONTINUOUS
    ELEC 1 HIDDEN
    ELEC 7 HIDDEN
    this is part of standardlayers.txt. the spaces are actually tab delimitation's

  6. #16
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,602

    Default

    Okay. Demonstrate for us thiese two lines here:
    ELEC 1 HIDDEN
    ELEC 7 HIDDEN

    If it finds a match. what then? what will be the new name?

    Anyhoo.. if the only problem is the loop. see previous post

  7. #17
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default

    OLD layer name: ELECTRICAL
    layer color: 1
    layer LT: HIDDEN

    (comparison to standardlayers.txt)

    NEW layer name: ELEC
    (command "-rename" "la" OLD NEW) <- IN LOOP


    its only comparing the color and linetype and if needed the characters in the name. More than likely it will need to compare the characters in the name
    Last edited by btraemoore; 30th Apr 2012 at 03:34 pm.

  8. #18
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,602

    Default

    See if i get this right. ELECTRICAL/1/HIDDEN will be ELEC, and ELECTRICAL/7/HIDDEN will also be ELEC, is that right?
    Use wcmatch for name comparison or a predicate function that reduces the list for comparison using the frist character on the Layer name

  9. #19
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default

    keep in mind that i am very new to lisp and do not know a lot of functions. my thought is that i will step though each existing layer checking the name against the list and if the name is not in my list, then run the function for changing the name. IE: all the crap with the color and lt checks. when i consider of the functionality of wcmatch with this routine, and correct me if im wrong, it would have to be its own function filtering the existing layer list prior to running my main routine??

  10. #20
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,602

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by btraemoore View Post
    all the crap with the color and lt checks. when i consider of the functionality of wcmatch with this routine, and correct me if im wrong, it would have to be its own function filtering the existing layer list prior to running my main routine??
    Yup, sort of... i can write a snippet for you.... you didnt answer my question though,

    ELECTRICAL/1/HIDDEN will be ELEC, and ELECTRICAL/7/HIDDEN will also be ELEC, is that right?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts