Author Topic: Save/restore xref layer states only  (Read 7796 times)

0 Members and 1 Guest are viewing this topic.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Save/restore xref layer states only
« on: November 10, 2008, 02:35:50 PM »
Anyone have anything that will save/restore layer states for xrefs ONLY?
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

pkohut

  • Guest
Re: Save/restore xref layer states only
« Reply #1 on: November 10, 2008, 02:47:40 PM »
Code or application?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Save/restore xref layer states only
« Reply #2 on: November 10, 2008, 02:51:06 PM »
I don't have one, but one could be written pretty easily I would assume. Just store the information in a dictionary within the drawing, and then you can call it when you opening it fresh again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #3 on: November 10, 2008, 02:51:18 PM »
Code or application?


Code preferably... Not too keen on running something that I don't know what it'll _really_ do.  No offense.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #4 on: November 10, 2008, 02:52:05 PM »
I don't have one, but one could be written pretty easily I would assume. Just store the information in a dictionary within the drawing, and then you can call it when you opening it fresh again.

This would just be like a one time thing.  It doesn't need to be run every time the drawing is opened.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Save/restore xref layer states only
« Reply #5 on: November 10, 2008, 02:56:51 PM »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Save/restore xref layer states only
« Reply #6 on: November 10, 2008, 02:58:39 PM »
I don't have one, but one could be written pretty easily I would assume. Just store the information in a dictionary within the drawing, and then you can call it when you opening it fresh again.

This would just be like a one time thing.  It doesn't need to be run every time the drawing is opened.
How do you know which layers are supposed to be on/off frozen/thawed?  The information could be stored in a global variable, and then just called by a program to restore/save.

How are you visioning it working?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

pkohut

  • Guest
Re: Save/restore xref layer states only
« Reply #7 on: November 10, 2008, 03:06:59 PM »
I don't remember fully but don't layer names with $ or | in them represent
attached or overlay xrefs?  Otherwise you just get the layer info through
normal means, with the addition that you need to check group code 70
bit 5 to see if the layer is dependent on an attached xref.

Paul

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #8 on: November 10, 2008, 03:12:28 PM »
What I'd like to do is basically match another drawing's layer states for selected xrefs.  The more I think about it, the more I realize I'm not sure how to approach this.  I could do some sort of DBX thang that loops through layers checking them against the good drawing's xref layers?  Or maybe save an external file and restore......whenever??  I dunno.  I guess I'm open for suggestions.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Save/restore xref layer states only
« Reply #9 on: November 10, 2008, 03:28:26 PM »
If you just want to copy from one drawing to the current, than that shouldn't be too hard, as long as the xrefs are named the same.  If not, then some mapping will come into play.  This could be done with VBA ( stated because I know you can code in it ).  If that is what you are after it wouldn't be too hard to come up with something.  Do you want to code it in VBA ( I can't really help, but give some ideas that I would use with Lisp and ActiveX )?  Or do you want to do it in Lisp?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #10 on: November 10, 2008, 03:34:47 PM »
Hmmm.... vba... now that you mention it, I did something with layers and saving/restoring (I think) a few years back.  I'll have to scour my CDs and see if I still have a copy of it.  If not, I might take a whack at it with VBA or maybe OpenDCL.  Wheeeeee!!!

I'm still open for ideas if you want to share.   :roll:
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Save/restore xref layer states only
« Reply #11 on: November 10, 2008, 03:36:44 PM »
What I'd like to do is basically match another drawing's layer states for selected xrefs.  The more I think about it, the more I realize I'm not sure how to approach this.  I could do some sort of DBX thang that loops through layers checking them against the good drawing's xref layers?  Or maybe save an external file and restore......whenever??  I dunno.  I guess I'm open for suggestions.
Are you just doing for one drawing one time?   (If am I reading you correctly)
IN that case creat and then export a layer "filter" from the "to be match" drawing and then import that filter into the file to the matching.  But I am probaly all wet. 

I will go back to drooling this :-D
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #12 on: November 10, 2008, 03:38:39 PM »
What I'd like to do is basically match another drawing's layer states for selected xrefs.  The more I think about it, the more I realize I'm not sure how to approach this.  I could do some sort of DBX thang that loops through layers checking them against the good drawing's xref layers?  Or maybe save an external file and restore......whenever??  I dunno.  I guess I'm open for suggestions.
Are you just doing for one drawing one time?   (If am I reading you correctly)
IN that case creat and then export a layer "filter" from the "to be match" drawing and then import that filter into the file to the matching.  But I am probaly all wet. 

I will go back to drooling this :-D

That would give me EVERY layer... I just want the xref layers.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Save/restore xref layer states only
« Reply #13 on: November 10, 2008, 03:42:29 PM »
Have a look at the following:

The following code opens and closes a DBX document

Code: [Select]
;;; Open a dbxDoc ;
;;; use (setq dbxDocument(kb:OpenDbxDocument dwgname)) ;
(defun kb:OpenDbxDocument (DwgName / app doc dbxopen dbxDoc)
  (setq app (vlax-get-acad-object)
        doc (vla-get-ActiveDocument app)
        )
  (if (/= dwgname (vla-get-fullname doc))
    (progn (cond ((= (substr (getvar "ACADVER") 1 5) "15.06")
                  (setq dbxDoc  (vla-GetInterfaceObject app "ObjectDBX.AxDbDocument")
                        dbxopen (vl-catch-all-apply 'vla-open (list dbxDoc DwgName))
                        )
                  )
                 (t
                  (setq dbxDoc  (vla-GetInterfaceObject
                                  app
                                  (strcat "ObjectDBX.AxDbDocument." (substr (getvar "acadver") 1 2))
                                  )
                        dbxopen (vl-catch-all-apply 'vla-open (list dbxDoc DwgName))
                        )
                  )
                 )
           (if (vl-catch-all-error-p dbxopen)
             (setq dbxDoc nil)
             )
           )
    )
  dbxDoc
  )

;;; Close dbxDoc
;;; (kb:CloseDbxDocument dbxDocument)
(defun kb:CloseDbxDocument (dbxdoc)
  (if (= (type dbxDoc) 'VLA-OBJECT)
    (progn (vlax-release-object dbxDoc) (setq dbxDoc nil))
    )
  )

This code will return a list of layer names to change.
arguments: xref; "*" returns ALL layers
                       nil returns the active doc layers only
                       "xr" returns ALL xref layers (filters "|")
                       "xrefname" returns only the layers of a single xref (filters "xrefname|")

Code: [Select]
(defun kb:GetLayerList (xref / layers ret)
  (setq layers (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
  (cond ((= xref "*") ;gets all layers
(vlax-for x layers (setq ret (append ret (list (vla-get-name x)))))
)
((= xref nil) ;gets only active doc layers
(vlax-for
x
layers
   (if (not (vl-string-search "|" (vla-get-name x)))
     (setq ret (append ret (list (vla-get-name x))))
     )
   )
)
((= xref "xr") ;gets all xref layers
(vlax-for
x
layers
   (if (vl-string-search "|" (vla-get-name x))
     (setq ret (append ret (list (vla-get-name x))))
     )
   )
)
(t ;gets a specific xref's layers
(vlax-for
x
layers
   (if (vl-string-search (strcat xref "|") (vla-get-name x))
     (setq ret (append ret (list (vla-get-name x))))
     )
   )
)
)
  ret
  )

This code will match the layer in the active drawing, local and / or xrefs, with the states of the layers in the dbx document.

arguments:
lstatename - the Layer State to use
dwgname - the drawing to be referenced (dbx doc)
layerList - which layers to change: see above.

Code: [Select]
(defun kb:LayerStateEngine (lstatename   dwgname layerlist     /
    dbxdoc   dbxdict dict       dbxplotstyles
    dbxlayernames dbxlinetypes
    )
  (setvar "clayer" "0")
  (princ "\nSetting the current layer to 0")
  (princ)
  (setq dbxdoc (kb:OpenDbxDocument DwgName))
  (if dbxdoc
    (progn (setq lstateobj (vla-GetInterfaceObject(vlax-get-acad-object)(strcat"AutoCAD.AcadLayerStateManager."(substr (getvar "ACADVER") 1 2))))
   (if lstateobj
     (progn (vla-setdatabase lstateobj (vla-get-database dbxdoc))
    (vlax-invoke lstateobj 'restore lstatename)
    (setq dbxlayers (vla-get-layers dbxdoc)
  layers    (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
  )
    ;get a list of layers in the dbxdoc - because there's no "has" method!
    (vlax-for
   x
    (vla-get-layers dbxdoc)
      (setq dbxlayernames
     (append dbxlayernames (list (strcase (vla-get-name x))))
    )
      )
    ;(setq n "X_Base43|A-Wall-Patt")
    ;(setq n(nth 3 layerlist))
    (foreach
   n
    layerlist
      (if (and (not (= n "0"))
       (member (strcase (kb:striplayername n)) dbxlayernames)
       )
(progn (setq lobj    (vla-item layers n)
     lobjdbx (vla-item dbxlayers (kb:striplayername n))
     )
       (foreach
      property
      (list "Freeze"   "LayerOn" "Lineweight"
    "Lock"   "Plottable" "color"
    )
(vlax-put lobj property (vlax-get lobjdbx property))
)
    ;set plotstyle
       (setq ps (vlax-get lobjdbx "PlotStyleName"))
       (kb:load-plotstyle dbxdoc ps)
       (vlax-put lobj "PlotStyleName" ps)
    ;set linetype
       (setq ln (vlax-get lobjdbx "Linetype"))
       (if (not (tblsearch "ltype" ln))
(setq newln
(vl-catch-all-apply
  'vla-CopyObjects
  (list dbxDoc
(vlax-safearray-fill
  (vlax-make-safearray vlax-vbObject '(0 . 0))
  (list (vla-item (vla-get-linetypes dbxDoc) ln))
  )
(vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object)))
)
  )
       )
)
       (if (tblsearch "ltype" ln)
(vlax-put lobj "Linetype" ln)
)
       )
)
      )
    )
     )
   (kb:CloseDbxDocument dbxdoc)
   (vlax-release-object lstateobj)
   )
    )
  (vla-regen
    (vla-get-activedocument (vlax-get-acad-object))
    acActiveViewport
    )
  )

jb
James Buzbee
Windows 8

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #14 on: November 10, 2008, 03:43:29 PM »
Hmmm.... vba... now that you mention it, I did something with layers and saving/restoring (I think) a few years back.  I'll have to scour my CDs and see if I still have a copy of it.  If not, I might take a whack at it with VBA or maybe OpenDCL.  Wheeeeee!!!

I'm still open for ideas if you want to share.   :roll:

Oooohhh..... I actually found it.  From October 2004.  It's not pretty, but it worked!  I just have to make it work for what I want to do now.


Code: [Select]
Option Explicit

Public Const strErrPath = "S:\CADDStds\Error_Logs\"


Public Sub SaveLayerState()
    Dim oXrec As AcadXRecord
    Dim oDict As AcadDictionary
    Dim oLayer As AcadLayer
    Dim vType() As Integer
    Dim vData() As Variant
    Dim i As Integer
   
    On Error GoTo ErrMsg
   
    ReDim Preserve vData(0 To i)
    ReDim Preserve vType(0 To i)
   
    Set oDict = ThisDrawing.Dictionaries.Add("MY_LAYERS")
    For Each oLayer In ThisDrawing.Layers
        vType(i) = 1
        ' Layer name
        ' Truecolor
        ' Linetype
        ' Plottable?
        ' Locked?
        ' On?
        ' Frozen
        vData(i) = oLayer.Name & "~!~" & oLayer.TrueColor.ColorIndex & "~!~" & oLayer.Linetype & "~!~" & oLayer.Plottable & "~!~" & oLayer.Lock & "~!~" & oLayer.LayerOn & "~!~" & oLayer.Freeze
        Set oXrec = oDict.AddXRecord("MY_LAYER_STATES")
        oXrec.SetXRecordData vType, vData
        i = i + 1
        ReDim Preserve vData(0 To i)
        ReDim Preserve vType(0 To i)
    Next
   
    Set oXrec = Nothing
    Exit Sub
   
ErrMsg:
    WriteError Err.Number, Err.Description, "Layer_State.dvb :: modMain.Main :: SaveLayerState", Now, ""
End Sub

Public Sub RestoreLayerState()
    Dim oLayer As AcadLayer
    Dim color As AcadAcCmColor
    Dim varResult As Variant
    Dim myDict As AcadDictionary
    Dim i As Integer
    Dim myXRec As AcadXRecord
    Dim dxfCode, dxfData
    Dim iLayer As Integer
   
    On Error GoTo ErrMsg
   
    Set myDict = ThisDrawing.Dictionaries.Item("MY_LAYERS")
    Set myXRec = myDict.Item("MY_LAYER_STATES")
    myXRec.GetXRecordData dxfCode, dxfData
   
    ThisDrawing.SetVariable "regenmode", 0
   
    On Error Resume Next
    For Each oLayer In ThisDrawing.Layers
        oLayer.Freeze = True
        oLayer.LayerOn = False
    Next oLayer
   
    For i = LBound(dxfData) To UBound(dxfData)
        varResult = Split(dxfData(i), "~!~", , vbTextCompare)
'''        Debug.Print varResult(0) ' Layer name
'''        Debug.Print varResult(1) ' Truecolor
'''        Debug.Print varResult(2) ' Linetype
'''        Debug.Print varResult(3) ' Plottable
'''        Debug.Print varResult(4) ' Locked
'''        Debug.Print varResult(5) ' On
'''        Debug.Print varResult(6) ' Frozen
        Set color = New AcadAcCmColor
        With color
            .ColorMethod = acColorMethodByACI
            .ColorIndex = varResult(1)
        End With
        Set oLayer = ThisDrawing.Layers(varResult(0))
        With oLayer
            .TrueColor = color
            .Linetype = varResult(2)
            .Plottable = varResult(3)
            .Lock = varResult(4)
            .LayerOn = varResult(5)
            .Freeze = varResult(6)
        End With
    Next i
    ThisDrawing.SetVariable "regenmode", 1
    ThisDrawing.Regen acAllViewports
    Exit Sub
   
ErrMsg:
    WriteError Err.Number, Err.Description, "Layer_State.dvb :: modMain.Main :: RestoreLayerState", Now, ""
    Resume Next
End Sub

Public Sub WriteError(iErrNum As Integer, sDesc As String, sSource As String, sDate As String, sOptionalInfo As String)
    '// Writes all errors to err.log
    Dim F As Integer
    F = FreeFile
    Open strErrPath & Format(Now, "mm-dd-yy__hh.mm.ss") & ".log" For Output As #F
    Print #F, "Error Number: " & iErrNum
    Print #F, "Description: " & sDesc
    Print #F, "Source: " & sSource
    Print #F, "Date: " & sDate
    Print #F, "More Info: " & sOptionalInfo
    Print #F, ""
    Close #F
End Sub
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

pkohut

  • Guest
Re: Save/restore xref layer states only
« Reply #15 on: November 10, 2008, 03:47:07 PM »
It's pretty easy to save them out to a file then restore them later.
This allows you to save different states for different needs.
Below is an example from a layerset, with the following fields:
Layername, state, color, linetype, lineweight, plot style name, is clayer
Code: [Select]
GRID 67 7 CONTINUOUS -3 Color_7 0
PROP_CORNERS 67 6 CONTINUOUS -3 Color_6 0
plan-siteplan$0$DCA_INFO 66 7 CONTINUOUS -3 Color_7 0
plan-siteplan-scheme1 (5)|DCA_INFO 80 7 CONTINUOUS -3 Color_7 0
plan-siteplan-scheme1 (5)|PROF_INFO 80 7 CONTINUOUS -3 Color_7 0
plan-siteplan-scheme1 (5)|00-VIEWPORTS 80 7 CONTINUOUS -3 Color_7 0

Paul

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #16 on: November 10, 2008, 03:49:51 PM »
It's pretty easy to save them out to a file then restore them later.

That's kinda what I'm leaning towards - I just have to decide if I'm going to do it with VBA or LSP/OpenDCL combo.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Save/restore xref layer states only
« Reply #17 on: November 10, 2008, 03:50:17 PM »
Are you just doing for one drawing one time?   (If am I reading you correctly)
IN that case creat and then export a layer "filter" from the "to be match" drawing and then import that filter into the file to the matching.  But I am probaly all wet. 

I will go back to drooling this :-D

That would give me EVERY layer... I just want the xref layers.
Returns just xref layers.  Core command and thing is Autodesk already set did this for you.  They even broke it down by each xref.  Again probably just something I am not seeing from here.  Darn Beer keeps distracting me.  Usually it the girls outside the window.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #18 on: November 10, 2008, 03:53:15 PM »
Are you just doing for one drawing one time?   (If am I reading you correctly)
IN that case creat and then export a layer "filter" from the "to be match" drawing and then import that filter into the file to the matching.  But I am probaly all wet. 

I will go back to drooling this :-D

That would give me EVERY layer... I just want the xref layers.
Returns just xref layers.  Core command and thing is Autodesk already set did this for you.  They even broke it down by each xref.  Again probably just something I am not seeing from here.  Darn Beer keeps distracting me.  Usually it the girls outside the window.


But can you export just that layer filter to an LAS file?  I haven't tried.  I assumed it took ALL of the layers.  I'll have to play around with that as soon as AutoCAD stops being stupid!!!  Not responding my arse!  You're just being lazy!!  You hear me AutoCAD??  Lay-freaking-zee!!

I'm good now.  Sorry.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #19 on: November 10, 2008, 03:56:53 PM »
Just as I thought... It grabs all layers.


Go back to being a drunk, you drunk!


(jealous)
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Save/restore xref layer states only
« Reply #20 on: November 10, 2008, 04:06:06 PM »
Just as I thought... It grabs all layers.


Go back to being a drunk, you drunk!


(jealous)
I am not that drunk yet.  It don't grab all the layers.  You screwed your filter some how.

It imports and exports just the filters.  not settings of the layers.  You will still have to make the changes to filtered layers in each file.  I do admit that code is easier if it is doing the setting for you.  But this is quick and dirty. 


Now come on 4:45.  Actually it will have to wait until tomorrow night because I have to take the oldest to her swimming lessons tonight.  :-(


I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #21 on: November 10, 2008, 04:09:12 PM »
.LFT files?? What version are you using?  I've got 2008 and it creates .LAS files.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #22 on: November 10, 2008, 04:10:18 PM »
Oh, wait a second... Yup.. There it is.  Ummm... I mean... WHOOMP!  There it is!!  WHOOMP!  There it is!!   :mrgreen:

Thanks!  That should work for the meantime.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Save/restore xref layer states only
« Reply #23 on: November 10, 2008, 04:24:17 PM »
See what happens when you go to lunch.  You miss all the good stuff.

James,

  How come you don't just use 'wcmatch' in the function 'kb:GetLayerList'?  I would think it would be easier, and then you could filter for any layer.


Glad you got something you can use Matt.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #24 on: November 11, 2008, 08:09:17 AM »
Oh, wait a second... Yup.. There it is.  Ummm... I mean... WHOOMP!  There it is!!  WHOOMP!  There it is!!   :mrgreen:

Thanks!  That should work for the meantime.

It should, but it doesn't.   :-(

It saves the filter, but not how the layers appear.  In other words, if I save an XREF (*|*) filter with all xref layer colors as gray then import that LFT file into another drawing, it won't change the color of the xref layers... it just adds the filter in the layer manager dialog box.  So it looks like I'm back to coding something.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Save/restore xref layer states only
« Reply #25 on: November 11, 2008, 08:31:29 AM »
Oh, wait a second... Yup.. There it is.  Ummm... I mean... WHOOMP!  There it is!!  WHOOMP!  There it is!!   :mrgreen:

Thanks!  That should work for the meantime.

It should, but it doesn't.   :-(

It saves the filter, but not how the layers appear.  In other words, if I save an XREF (*|*) filter with all xref layer colors as gray then import that LFT file into another drawing, it won't change the color of the xref layers... it just adds the filter in the layer manager dialog box.  So it looks like I'm back to coding something.

It imports and exports just the filters.  not settings of the layers.  You will still have to make the changes to filtered layers in each file.  I do admit that code is easier if it is doing the setting for you.  But this is quick and dirty. 
:wink:  :-)
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Save/restore xref layer states only
« Reply #26 on: November 11, 2008, 08:38:19 AM »
Oh, wait a second... Yup.. There it is.  Ummm... I mean... WHOOMP!  There it is!!  WHOOMP!  There it is!!   :mrgreen:

Thanks!  That should work for the meantime.

It should, but it doesn't.   :-(

It saves the filter, but not how the layers appear.  In other words, if I save an XREF (*|*) filter with all xref layer colors as gray then import that LFT file into another drawing, it won't change the color of the xref layers... it just adds the filter in the layer manager dialog box.  So it looks like I'm back to coding something.

It imports and exports just the filters.  not settings of the layers.  You will still have to make the changes to filtered layers in each file.  I do admit that code is easier if it is doing the setting for you.  But this is quick and dirty. 
:wink:  :-)

I didn't read everything.... I was just skimming over the thread.   :oops:
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Save/restore xref layer states only
« Reply #27 on: November 11, 2008, 11:02:32 AM »
Do you need help coding it?  Or you got it under control?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Save/restore xref layer states only
« Reply #28 on: November 11, 2008, 11:06:14 AM »
Quote
How come you don't just use 'wcmatch'

Ha!  yea, that would be better wouldn't it.  Why? beccause this was originally written a very long time ago . . . before I knew all the smart people here at the swamp  :wink:
James Buzbee
Windows 8