Results 1 to 3 of 3

Thread: Can scripts be used to apply "Saved Layer States"

  1. #1
    Join Date
    Western suburbs of Miami-Dade, Florida
    Login to Give a bone

    Red face Can scripts be used to apply "Saved Layer States"

    I'm working with a rather large project and need to implement scripts to automate a lot of tedious repetative commands on several subsets of sheets that each contain perhaps 30-50 drawings (Existing Conditions, Demolition, Paving & Grading, Drainage, Watermains,...). We really didn't know how to put the project together in a "Best Practices" manner when we started and each subsequent set was created by making a copy of the preceeding set and making the necessary alterations to taylor it to the new subset usage. This just magnified the amount of "undone and done wrongly" items and somewhat (geometrically) magnified the pending problems as each subset was developed. So now we've got pretty much of a (nightmare) mess on our hands trying to get it to satisfy client comments and project standards that never got "attended to" along the way... and all this as we continue trying to get office standards of our own established and under control.
    At the moment I'm just trying to "batch-process" a script that I've developed for one subset and I want to add a task of updating the latest "Saved Layer State". Perhaps I'm just getting a bit "burned-out" but I can't find the "command-line" version of the layer manager commands and options to add this task to my script. Is this beyond the capabilities of simple script language and do I need to use actual lisp language (which is above my current abilities)? Is there another method to automate this task that I am unaware or ignorant?
    My appreciation for any leads (or even the info that I'm wasting my time trying to add this particular task to a script).
    -Richard Domke, Miami, Fl.
    Point(s) to ponder: It seems to me that the time to do something right the first time is cheaper, in the long run, than the time to fix it. ...(and viewed from another angle: there's never enough time to do it right but there's always time to do it twice (when you have to correct it). AAAhh, its best. Are we having fun yet, or what?!

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    Hartford, Michigan
    Login to Give a bone

    Default Re: Can scripts be used to apply "Saved Layer States"

    I dont know about scripts, but I did write a program to set our layers proper. It might be way overkill and I would appreciate any tips to improve it, it is a pain to keep track of all the layers.
    (defun c:RoadBaseLayers    ()
      (command "linetype" "_load" "*" "acad" "")
        "layer" "NEW"
        "Aerial,Annotation,Boundary,Break Line,Calcs,Description,Dim,Ex Asphalt,Ex Bridge,Ex Building,Ex Bush,Ex Cable,Ex Concrete,Ex Contours,Ex Contours Annotation,Ex Contours IDX,Ex Curb Back,Ex Curb EM,Ex Curb Pan,Ex Deck,Ex Easement,Ex Electric,Ex Electric OH,Ex Fence,Ex Fiber,Ex Forcemain,Ex Gas,Ex Gravel,Ex Guardrail,Ex Landscaping,Ex Overhang,Ex Railing,Ex Railroad,Ex Riprap,Ex Road Asphalt,Ex Road CL,Ex Road Concrete,Ex Road Gravel,Ex Road Hatch,Ex Sidewalk,Ex Sanitary,Ex Spot Grade,Ex Storm,Ex Storm Drain,Ex Stripe PKG,Ex Stripe Road,Ex Surface,Ex Surface Water,Ex Tele,Ex Tree,Ex Treeline,Ex Wall,Ex Water,Ex Wetland"
        "Ex Concrete Hatch,Ex Asphalt Edge,Ex Gravel Hatch,Ex Landscaping Hatch,Ex Feature,Grading Permits,Image,Misc,Prop Bridge,Prop Contours,Prop Drive,Prop Drive Hatch,Prop Easement,Prop EP Edge of Metal,Prop EP Forcemain,Prop EP Forcemain 3D,Prop EP Forcemain Notes,Prop EP ROW,Prop EP Storm,Prop EP Storm 3D,Prop EP Storm Notes,Prop EP Sanitary,Prop EP Sanitary 3D,Prop EP Sanitary Notes,Prop Fence,Prop Forcemain,Prop Guardrail,Prop Lots,Prop Pavt Mrkg,Prop Pavt Mrkg Ex Surface,Prop Riprap,Prop Road,Prop Road CL,Prop ROW,Prop SESC Temp,Prop Slope Stake,Prop Sanitary,Prop Sidewalk,Prop Sign,Prop Storm,Prop Storm Drain,Prop Water,Property,Property Owners"
        "PT Bldg,PT Bldg DES,PT Bldg ELV,PT Bldg NO,PT Bldg FF,PT BM,PT Bndy,PT Bndy DES,PT Bndy ELV,PT Bndy NO,PT Bndy SC,PT Bndy TP,PT Bridge,PT Critical Dune,PT DEQ DES,PT DEQ ELV,PT DEQ NO,PT Feature,PT Feature DES,PT Feature ELV,PT Feature NO,PT Groundshot,PT Groundshot DES,PT Groundshot ELV,PT Groundshot NO,PT Groundshot UW,PT Groundshot UW DES,PT Groundshot UW ELV,PT Groundshot UW NO,PT Manhole,PT Misc,PT Misc DES,PT Misc ELV,PT Misc NO,PT Railroad,PT Road,PT Road DES,PT Road ELV,PT Road NO,PT Soil Boring,PT Surface,PT Surface DES,PT Surface ELV,PT Surface NO,PT Survey Control CL,PT Survey Control Curb,PT Survey Control DES,PT Survey Control NO,PT Traffic,PT Traffic DES,PT Traffic ELV,PT Traffic NO,PT Tree DES,PT Tree ELV,PT Treeline,PT Tree NO,PT Txt,PT Util Comm,PT Util Electric,PT Util Electric OH,PT Util FOP,PT Util Gas,PT Util DES,PT Util ELV,PT Util NO,PT Util Sanitary,PT Util Storm,PT Util Water,PT Wetland"
        "ROW,Section Line,Setback,Sta Annotation,Survey,Text,Tin,Tin Boundary,To Be Removed,Traverse,Viewport,Xref"
        "COLOR" "1"
        "Prop Bridge,Prop Easement,Prop Lots,Prop Slope Stake,Grading Permits,Prop Contours,Prop Drive,Prop Road,Prop Road CL"
        "COLOR" "2"
        "Boundary,ROW,Prop ROW,Prop EP ROW"
        "COLOR" "3"
        "Annotation,Description,Dim,Prop Fence,Prop Guardrail,Prop Sign,Section Line,Text,Prop EP Forcemain Notes,Prop EP Sanitary Notes,Prop EP Storm Notes,To Be Removed,Traverse"
        "COLOR" "4"
        "Prop SESC Temp,Prop Pavt Mrkg Ex Surface,Ex Concrete,Ex Curb Back,Ex Curb EM,Ex Guardrail,Ex Road Concrete,Ex Sidewalk,Ex Surface,Ex Surface Water,PT*DES,Prop Riprap"
        "COLOR" "5"
        "PT Bndy SC,Ex Asphalt,Ex Building,Ex Fence,Ex Road Asphalt,Ex Road CL,Ex Feature,PT Feature,PT*ELV"
        "COLOR" "6"
        "Ex Gravel Hatch,Ex Landscaping Hatch,Ex Stripe PKG,Ex Stripe Road,Ex Easement,Ex Curb Pan,Ex Overhang,Ex Riprap,Ex Wetland,Property,Property Owners,Prop Drive Hatch,Prop Pavt Mrkg,PT Txt"
        "COLOR" "7"
        "Ex Spot Grade,0,Aerial,Calcs,Ex Gravel,Ex Railroad,Ex Road Gravel,Image,Misc,Prop EP Edge of Metal,Prop EP Forcemain 3D,Prop EP Sanitary 3D,Prop EP Storm 3D,PT Bldg,PT Bldg FF,PT BM,PT Bndy,PT Bndy TP,PT Critical Dune,PT Groundshot,PT Misc,PT Road,PT Surface,PT Survey Control CL,Setback,PT Survey Control Curb,PT Traffic,PT Wetland,Tin,Tin Boundary,PT*NO,Xref"
        "COLOR" "8"
        "Ex Asphalt Edge"
        "COLOR" "9"
        "Ex Concrete Hatch"
        "COLOR" "24"
        "Ex Forcemain,Ex Sanitary,PT Util Sanitary"
        "COLOR" "30"
        "Ex Cable,Ex Fiber,Ex Tele,PT Util Comm,PT Util FOP"
        "COLOR" "33"
        "Prop EP Forcemain,Prop EP Sanitary,Prop Sanitary,Prop Forcemain"
        "COLOR" "51"
        "Ex Gas,PT Util Gas"
        "COLOR" "70"
        "Ex Bush,Ex Tree,Ex Treeline"
        "COLOR" "81"
        "Prop EP Storm,Prop Storm,Prop Storm Drain"
        "COLOR" "90"
        "Ex Contours Annotation,Ex Contours IDX"
        "COLOR" "91"
        "Ex Storm Drain,Ex Storm,PT Util Storm"
        "COLOR" "119" "Viewport"
        "COLOR" "141"
        "Ex Water,PT Util Water"
        "COLOR" "163"
        "Prop Water"
        "COLOR" "181"
        "COLOR" "210"
        "Ex Contours"
        "COLOR" "211"
        "Ex Electric,Ex Electric OH,PT Util Electric,PT Util Electric OH"
        "COLOR" "252"
        "Prop Sidewalk"
        "COLOR" "254"
        "Ex Road Hatch"
        "LTYPE" "CENTER2"
        "Ex Road CL,Section Line"
        "Prop SESC Temp,Prop Bridge,Ex Contours,Ex Contours IDX,0,Calcs,Prop Lots,Centerline,Boundary,Ex Feature,Misc,Prop EP Sanitary 3D,Prop EP Sanitary Notes,Prop EP Storm 3D,Prop EP Storm Notes,Xref"
        "LTYPE" "Dashed"
        "Ex Overhang"
        "LTYPE" "FM"
        "Ex Forcemain,Prop EP Forcemain,Prop Forcemain"
        "LTYPE" "Guardrail"
        "Ex Guardrail,Prop Guardrail"
        "LTYPE" "HIDDEN1"
        "Prop Pavt Mrkg Ex Surface,Ex Asphalt,Ex Concrete,Ex Curb Back,Ex Curb EM,Ex Curb Pan,Ex Gravel,Ex Road Asphalt,Ex Road Concrete,Ex Road Gravel,Ex Sidewalk,Ex Surface,Ex Surface Water"
        "LTYPE" "HIDDENX2"
        "Prop Slope Stake,Setback"
        "LTYPE" "PHANTOM2"
        "Ex Easement,Prop Easement,Grading Permits,Property,ROW,Prop ROW,Prop EP ROW"
        "LTYPE" "REMOVAL"
        "To Be Removed"
        "LTYPE" "SAN-S"
        "Ex Sanitary,Prop EP Sanitary,Prop Sanitary"
        "LTYPE" "ST-S"
        "Ex Storm,Prop EP Storm,Prop Storm"
        "LTYPE" "Storm Drain"
        "Ex Storm Drain,Prop Storm Drain"
        "LTYPE" "WATER"
        "Ex Water,Prop Water"
        "LTYPE" "W-CABLE"
        "Ex Cable"
        "LTYPE" "W-ELECTRIC"
        "Ex Electric"
        "LTYPE" "W-FENCE"
        "Ex Fence,Prop Fence"
        "Ex Fiber"
        "LTYPE" "W-GAS"
        "Ex Gas"
        "Ex Electric OH"
        "LTYPE" "W-TELE"
        "Ex Tele"
        "PLOT" "NOPLOT"
        "Viewport,Prop EP Edge of Metal"
        "FREEZE" "Annotation,Calcs,Description,Ex Asphalt Edge,Ex Concrete Hatch,Ex Gravel Hatch,Ex Landscaping Hatch,Traverse"
        "") ;_ end of command
    ) ;_ end of defun
    the above sets layers in our "base" drawing
    Christopher T. Cowgill, P.E.
    Autodesk Expert Elite
    AEC Collection Civil 3D 2020
    Windows 10

  3. #3
    Administrator rkmcswain's Avatar
    Join Date
    Login to Give a bone

    Default Re: Can scripts be used to apply "Saved Layer States"

    Quote Originally Posted by rdomke.130413 View Post
    ... but I can't find the "command-line" version of the layer manager commands
    (command "._layer" "_A" "_R" "layer_state_1" "" "")
    Command: -layer
    Current layer:  "0"
    Enter an option 
    /stAte]: _A
    Enter an option [?/Save/Restore/Edit/Name/Delete/Import/EXport]: _R
    Enter name of layer state to restore or [?]: layer_state_1
    Enter an option [?/Save/Restore/Edit/Name/Delete/Import/EXport]:
    Enter an option 
    Regenerating model.
    (That is not actually a SCRipt file, just showing the steps needed)
    R.K. McSwain | CAD Panacea |

Similar Threads

  1. 2014: "Operation could not be completed" -> "File not saved"
    By Andre Voss in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 4
    Last Post: 2014-02-21, 05:59 PM
  2. XREF "Saved Path" to "Found at" location
    By cadmancando in forum AutoLISP
    Replies: 1
    Last Post: 2012-01-18, 03:54 PM
  3. importing layer states via "layerstate-import" function
    By kmayhew936033 in forum AutoLISP
    Replies: 10
    Last Post: 2011-09-30, 08:02 AM
  4. Replies: 0
    Last Post: 2011-03-15, 05:44 PM
  5. System variariable for "invert filter" and "apply to layers toolbar" checkboxes
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2005-11-23, 05:58 PM

Posting Permissions

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