Jump to content

Recommended Posts

Posted

Hello guys ... :)

 

I need an urgent help , and hope somebody can help me with it .

 

I have a drawing (mother drawing)that contains my standard layers , and in the other drawings i have the same layers but some of them is not matching the same colors , lineweights and ltypes .

 

is there a lisp that can pull out the layers from (mother drawing) and modify the layers in the other drawings accordingly ?

 

Thankxxxxxxxx

Posted

I am sorry , that is not my needs now . :cry:

 

I want to modify the layers according to the layers from the (mother drawing) .

Posted

As I suggested before, you should consider using a Standards file (.DWS)... From the Help:

 

 

Overview of CAD Standards

 

 

The auditing process uses standards plug-ins, applications that define the rules for the properties that are checked for individual named objects. Layers, dimension styles, linetypes, and text styles are each checked against their corresponding plug-ins. You can specify which plug-ins to use when checking a drawing for standards violations. Autodesk or third-party developers may add standards plug-ins for checking additional drawing properties. All plug-ins check all properties for each named object except for the layer plug-in. The following layer properties are checked when using the layer plug-in:

 

  • Color
  • Linetype
  • Lineweight
  • Plot style mode
  • Plot style name (when the PSTYLEMODE system variable is set to 0)

The following layer properties are not checked by the layer plug-in:

 

  • On/Off
  • Freeze/Thaw
  • Lock
  • Plot/No Plot

 

HTH

Posted

Open "mother drawing" and SaveAs a new dwg. Open your work drawing, copy all with ctrl+c, switch to the new created dwg and paste to original coordinates...

Posted

Use the Design Center to borrow content from the "mother" drawing.

Posted

Here's something that should export the layer tables data into a lisp file ( mother.lsp ) that could be used over and over. It knows nothing about linewights plot widths yada yada yada

 

[color=#8b4513];;;EXPORT LAYER TABLES IN LSP FORMAT[/color]
[color=#8b4513];;;IGNORES XREF LAYERS[/color]

[b][color=BLACK]([/color][/b]defun c:x-laylsp [b][color=FUCHSIA]([/color][/b]/ wf td ln lt lc ls lf lz ll[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq wf [b][color=NAVY]([/color][/b]open [color=#2f4f4f]"mother.lsp"[/color] [color=#2f4f4f]"w"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]write-line [color=#2f4f4f]"[b][color=NAVY]([/color][/b]command \"[/color]_.LAYER\[color=#2f4f4f]"[b][color=NAVY])[/color][/b]"[/color] wf[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]setq td [b][color=MAROON]([/color][/b]tblnext [color=#2f4f4f]"LAYER"[/color] [b][color=GREEN]([/color][/b]not td[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq ln [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 2 td[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              lt [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 6 td[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              lc [b][color=MAROON]([/color][/b]abs [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 62 td[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              ls [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]minusp [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 62 td[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [color=#2f4f4f]"_Off"[/color] [color=#2f4f4f]"_On"[/color][b][color=MAROON])[/color][/b]
              lf [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 70 td[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              lz [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]logand lf 1[b][color=BLUE])[/color][/b] 1[b][color=GREEN])[/color][/b] [color=#2f4f4f]"_Freeze"[/color] [color=#2f4f4f]"_Thaw"[/color][b][color=MAROON])[/color][/b]
              ll [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]logand lf 4[b][color=BLUE])[/color][/b] 4[b][color=GREEN])[/color][/b] [color=#2f4f4f]"_Lock"[/color] [color=#2f4f4f]"_Unlock"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
         [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]/= [b][color=GREEN]([/color][/b]logand lf 16[b][color=GREEN])[/color][/b] 16[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]progn
               [b][color=GREEN]([/color][/b]write-line [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"[b][color=RED]([/color][/b]if [b][color=PURPLE]([/color][/b]not [b][color=TEAL]([/color][/b]tblsearch \"[/color]LAYER\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b]"[/color][b][color=RED])[/color][/b] wf[b][color=BLUE])[/color][/b]
               [b][color=BLUE]([/color][/b]write-line [b][color=RED]([/color][/b]strcat [color=#2f4f4f]"    [b][color=PURPLE]([/color][/b]command \"[/color]_New\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]princ[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]"[/color][b][color=BLUE])[/color][/b] wf[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]write-line [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"[b][color=RED]([/color][/b]if [b][color=PURPLE]([/color][/b]tblsearch \"[/color]LTYPE\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" lt "[/color]\[color=#2f4f4f]"[b][color=PURPLE])[/color][/b]"[/color][b][color=RED])[/color][/b] wf[b][color=BLUE])[/color][/b]
               [b][color=BLUE]([/color][/b]write-line [b][color=RED]([/color][/b]strcat [color=#2f4f4f]"    [b][color=PURPLE]([/color][/b]command \"[/color]_LTYPE\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" lt "[/color]\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=PURPLE])[/color][/b]"[/color][b][color=RED])[/color][/b]wf[b][color=BLUE])[/color][/b]
               [b][color=BLUE]([/color][/b]write-line [b][color=RED]([/color][/b]strcat [color=#2f4f4f]"    [b][color=PURPLE]([/color][/b]alert \"[/color]LINETYPE [color=#2f4f4f]" lt "[/color] Does Not Exist In This Drawing\[color=#2f4f4f]"[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]"[/color][b][color=BLUE])[/color][/b] wf[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]write-line [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"[b][color=RED]([/color][/b]command \"[/color]_Color\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" [b][color=PURPLE]([/color][/b]itoa lc[b][color=PURPLE])[/color][/b] "[/color]\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=RED])[/color][/b]"[/color][b][color=BLUE])[/color][/b] wf[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]write-line [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"[b][color=RED]([/color][/b]command \"[/color][color=#2f4f4f]" ll "[/color]\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=RED])[/color][/b]"[/color][b][color=BLUE])[/color][/b] wf[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]write-line [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"[b][color=RED]([/color][/b]command \"[/color][color=#2f4f4f]" ls "[/color]\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=RED])[/color][/b]"[/color][b][color=BLUE])[/color][/b] wf[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]write-line [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"[b][color=RED]([/color][/b]command \"[/color][color=#2f4f4f]" lz "[/color]\[color=#2f4f4f]" \"[/color][color=#2f4f4f]" ln "[/color]\[color=#2f4f4f]"[b][color=RED])[/color][/b]"[/color][b][color=BLUE])[/color][/b] wf[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
       [b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]write-line [color=#2f4f4f]"[b][color=NAVY]([/color][/b]command \"[/color]\[color=#2f4f4f]"[b][color=NAVY])[/color][/b]"[/color] wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]close wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

In the child drawing:

 

Command: (load "MOTHER")

 

 

-David

Posted

Perhaps I am mistaken, but I thought that if you created a drawing template from the Mother drawing. and then started a new drawing based on that template, and then inserted a given drawing into it, then all layers of similar name would take on the properties of the Mother drawing. No lisp needed.

Posted
Perhaps I am mistaken, but I thought that if you created a drawing template from the Mother drawing. and then started a new drawing based on that template, and then inserted a given drawing into it, then all layers of similar name would take on the properties of the Mother drawing. No lisp needed.

 

Actually, any layers (or entities on said layers) being inserted will inherit the layer properties of the receiving drawing's layers.

 

Employing a drawing standards file (.DWS) allows for one to 'manage' drawings, so that they adhere to a given standard. These standards files can be as strict or flexible as one chooses to make them, for example, only standardizing the layers in this case.

Posted

There are already quite a few ways. The Drawing Standards is one way (not the fastest as you have to click for each change).

 

Then the saveas, erase all and copy-n-paste idea is an old one, but not bad - unfortunately it doesn't account for Paper Space tabs and non-graphical stuff like XData in Registered Apps (not always needed but could cause problems with Addons/Verticals). Alternatively you could use Insert & Explode instead - basically does the same, but adds all non-graphical stuff. For your Tabs you need to import them from another DWG (on tab's Right-Click menu).

 

As for Design Center ... that's fine if the layer doesn't exist yet. But what if it does and has a non-standard colour? No unfortunately DC is not the best for this case. Actually that Steal of Lee's does the same as DC does, it doesn't overwrite existing Layers with imported properties, it only imports new Layers.

 

Another way might be to use Layer States. Create a LS in the mother DWG, export it to a LAS file. Then import & apply in the other files (can even be scripted using the Lisp layerstate-* functions, or in newer versions of ACad the -LAYER command also has a State manager).

 

Edit: Yet another way would be to use the Layer Translate command (LayTrans). That way you need not have a DWS, can be maped to a DWG / DWT if you wish. Then simply click the Map same button & Translate. Unfortunately this can't be scripted over multiple DWGs.

Posted

I'm a big fan of LAYTRANS, although I rarely have occasion to use it, I think it is largely overlooked, and very useful as you can save mappings, perhaps to facilitate working with drawings from various repeat contacts, with a minimum of hassle, and a modicum of comfort.

Using Standards doesn't have to be slow and can be used automatically, if set as shown in the image, save that I have not indicated the required .DWS reference.

pretty easy standards like this.jpg

Posted

Yes, that does make life easier. The only hassle I have with it is when there's a non-standard named layer (which I find constantly in our DWGs). Sometimes its something stupid like someone's used an underscore instead of a dash, or a space, or some twerp though a point might look nice. Or heaven forbid: CamelCase

 

Anyhow, from the OP I figure he's got lots of DWGs where he needs to change their layer properties to match one. I.e. some form of scripting would be the least time wastage, rather than opening a DWG, set it's standard & run the check, then open the next. I.e. layer states would be his best bet in a SCR and run it through ScriptPro/AutoScript/etc.

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