TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DanB on November 02, 2005, 02:31:59 PM
-
We have 4-5 frequently used company layer filters (AutoCAD 2006, LDD 2006, 3-4 users on Civil 3d 2006). A co-worker made a request for a Key-in/macro that will set a Filter "current" and apply this to the layer manager pull-down without opening the Layer Manager. We typically have a basemap xref that has numerous layers that must be scanned (slowly) as the Layer Manager opens. How does one go about accessing the layer filters that are defined in the drawing through LISP? I think with a push in the right direction I can do the rest of it (I hope) myself. Hints? Ideas?
Thanks in advance,
Dan
-
push (http://www.theswamp.org/forum/index.php?topic=2760.0)
-
If you are referring to:
(defun C:LayerFiltersDelete ()
(vl-Load-Com)
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove (vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object))))
"ACAD_LAYERFILTERS")))
(princ "\nAll layer filters have been deleted.")
(princ)
)
I don't believe AutoCAD 2006 stores the filter information as it did in older versions. The above routine no longer deletes filters in my drawing.
-
*shrug* I know jack about lisp but you might try
(defun C:LayerFiltersDelete ()
(vl-Load-Com)
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove (vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object))))
"ACLYDICTIONARY")))
(princ "\nAll layer filters have been deleted.")
(princ)
)
Hadn't thought about it but between r15 and r16 it switched from ACAD_LAYERFILTERS to ACLYDICTIONARY
-
Robert Bell's "LFD" modified to work in 2005 & 2006 , with wildcards, should give you something to work with.
http://discussion.autodesk.com/servlet/JiveServlet/download/130-335314-3861685-30875/LayerFiltersDelete.lsp
-
I have not yet seen anything that will let you set a layer filter current. I have seen other post asking the question in other forumns, but none have had an answer of how to do it. Sorry.
Tim
-
You may have to go the command route:
(command "-lman" "restore" "putyourlayerstatehere" "")
coded blindly - hope it works
-
Layer state and layer filter are two different animals.
-
To the best of my knowledge, the layer filters are not exposed to Lisp or VBA. I have tried to get filters in code, and was denied both times. Maybe 2006 / 2007 has it
-
Maybe 2006
Nope / 2007 has it
If Adesk decides to listen.
-
I think this task is either beyond my LISPing capabilities or is just not feasible. Thanks all for the replies/comments. Ii do check in from time to time, so if any new discoveries are made for accessing Layer filters please share.
-
I didn't want to discourage you by telling you that you couldn't do it. Heck, there was a chance that you would trip over something that everyone else had missed. Then you would be legendary. You would be the hero of literally tens of people.
-
Am I missing something here? Aren't layer filters just an entry in an extension dictionary attached to the layers collection?
====================================Object====================================
<IAcadLayers2 2130144272>
==================================Properties==================================
_NewEnum <IUnknown>
Application <IAcadApplication>
Count 10
Database <IAcadDatabase>
Document <IAcadDocument>
Handle 2
HasExtensionDictionary :vlax-true
ObjectID 2130144272
ObjectName AcDbLayerTable
OwnerID 0
===================================Methods====================================
Add
Delete
Erase
GenerateUsageData
GetExtensionDictionary
GetXdata
Item
SetXdata
===============================DXF Group Codes================================
-1 <Entity name: 7ef76c10>
0 TABLE
2 LAYER
5 2
102 {ACAD_XDICTIONARY
360 <Entity name: 7ef76ee0>
102 }
330 <Entity name: 0>
100 AcDbSymbolTable
70 10
====================================Object====================================
<IAcadDictionary 2130144992>
==================================Properties==================================
_NewEnum <IUnknown>
Application <IAcadApplication>
Count 2
Database <IAcadDatabase>
Document <IAcadDocument>
Handle 94
HasExtensionDictionary :vlax-false
Name <Null Object, Reference or Value>
ObjectID 2130144992
ObjectName AcDbDictionary
OwnerID 2130144272
===================================Methods====================================
AddObject
AddXRecord
Delete
Erase
GetExtensionDictionary
GetName
GetObject
GetXdata
Item
Remove
Rename
Replace
SetXdata
===============================DXF Group Codes================================
-1 <Entity name: 7ef76ee0>
0 DICTIONARY
330 <Entity name: 7ef76c10>
5 94
100 AcDbDictionary
280 1
281 1
3 ACAD_LAYERFILTERS
360 <Entity name: 7ef76ef0>
3 ACLYDICTIONARY
360 <Entity name: 7ef76ee8>
====================================Object====================================
<IAcadDictionary 2130145008> (1/2 of <IAcadDictionary 2130144992>)
==================================Properties==================================
_NewEnum <IUnknown>
Application <IAcadApplication>
Count 0
Database <IAcadDatabase>
Document <IAcadDocument>
Handle 96
HasExtensionDictionary :vlax-false
Name ACAD_LAYERFILTERS
ObjectID 2130145008
ObjectName AcDbDictionary
OwnerID 2130144992
===================================Methods====================================
AddObject
AddXRecord
Delete
Erase
GetExtensionDictionary
GetName
GetObject
GetXdata
Item
Remove
Rename
Replace
SetXdata
===============================DXF Group Codes================================
-1 <Entity name: 7ef76ef0>
0 DICTIONARY
5 96
102 {ACAD_REACTORS
330 <Entity name: 7ef76ee0>
102 }
330 <Entity name: 7ef76ee0>
100 AcDbDictionary
280 0
281 1
-
Michael, correct you are. However, I have not seen anyone be able to set which one the Layer dialogue uses. Therein lies the problem.......
-
Ahhh, thanks for lighting the candle Jeff.
:)