+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 40
  1. #1
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    Electrical 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    55

    Smile <-- this guy needs some help

    Registered forum members do not see this ad.

    Code:
    ;;;get a working list of all the layers
    	(vl-load-com)
    	(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
    	(setq layertable (vla-get-layers acadDocument))
    ;;;make layers an array and editable
    ;;;make the properites of the layers accessable
    ;;;check the names against a standard list of valid layer names
    ;;;remove valid layers from the working list
    ;;;check the first layers color
    ;;;get a list of all valid layers with that color from the standard layers list
    ;;;check the line type of the first layer
    ;;;get a list of all valid layers with same line type from the modified list
    ;;;change the layer name to the standard valid layer name

    this is my check list, I've gotten past step 1 and am at a loss now and I'm pretty sure im way off ... i need some redirection, can anybody help?

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    This will help you build a list of layers associated lists:
    Code:
    (setq theLayer (cdr (assoc 2 (tblnext "LAYER" 1))))
    (while theLayer
     (setq listLayers (append listLayers (list (entget (tblobjname "LAYER" theLayer))))
           theLayer (cdr (assoc 2 (tblnext "LAYER"))))
    )
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

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

    Default

    awesome, this is a good start. now i need to figure out how to get the color. i was thinking vlax-dump or vla-getcolor but i tried them and was getting a listp error

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    In layer's associated list the color is stored under DXF code 62.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  5. #5
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Can you elaborate a bit more what it is that your actually trying to achieve is it some form of layer management for users or what ? Just ignoring code questions for a moment.
    A man who never made mistakes never made anything

  6. #6
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    Electrical 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    55

    Default

    I'm actually trying to make a routine that will automatically change the names of layers dependent upon the layer color and line type.

  7. #7
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    Then, you should look for DXF codes 62 (color) and 6 (linetype).
    Code:
    (setq assocLayer (tblsearch "LAYER" LayerName)
          theName (strcat (itoa (cdr (assoc 62 assocLayer)))   ;color
                          "-"
                          (cdr (assoc 6 assocLayer))))         ;linetype
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  8. #8
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    Electrical 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    55

    Default

    yes, i defiantly used the code to set my lt and color variables, im trying to figure out how to get a table length so i can set my while loop, and then i have to figure out how to compare it to the list that i have.

  9. #9
    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,089

    Default

    Will that be Linetype AND Color match?

    At any rate, I suppose you will be adding a suffix or prefix on the layer name and NOT replace the entire name.

  10. #10
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    Electrical 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    55

    Default

    Registered forum members do not see this ad.

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

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