LayerStates

LayerStates

Civil3DReminders_com
Mentor Mentor
238 Views
1 Reply
Message 1 of 2

LayerStates

Civil3DReminders_com
Mentor
Mentor

I'm updating the layers for a LayerState after swapping an XREF of one with another. I'm noticing I'm making the list quite large since the old XREF layerStates remain in the ResultBuffer. AutoCAD seems to keep around the clear out the ObjectId Layer values to null. 

(93,0)
	(331,(0))
	(1,Color_2)(440,0)
	(330,(0))
	(90,8)
	(62,30)
	(370,35)

Does anyone know if Autodesk stores the XREF Layer information. So if the user reattaches the XREF they come back? Or is it just Autodesk not cleaning the list up? This would explain why some people say you should recreate templates each year, since recreating the template would get rid of all of these orphaned layerstates.

 

I think I want to swap wout the ObjectId.Null with the new value instead of adding new ones. But I'm afraid I might break something that isn't exposed in the API.

Civil3DReminders_com_0-1762542194193.png

https://help.autodesk.com/view/OARX/2026/ENU/?guid=GUID-80B3DAD6-B1F6-4BCC-86C7-7FA2444EEDFB

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
239 Views
1 Reply
Reply (1)
Message 2 of 2

BlackBox_
Advisor
Advisor

In a quick test, I attached an XREF, changed the XREF layer colors, created a layer state, then detached the XREF and changed the layer state to another. 

 

After re-attaching the same XREF (same XREF name in the host DWG), attempting to restore the previous layer state (made for that XREF) - the layer state did not restore the XREF layer colors.

 

I use layer states all the time and have automated reloading them at drawing open, but I'm deleting them first before re-importing & applying them, rather than modifying the internals.

 

Also, not sure if there's a conflicting CAD standard or perhaps client policy, but you might consider renaming your XREFs on attachment, as this makes layer states portable between projects without having to rename layer state elements.

 

So, for an XREF 1234-AA.dwg where 1234 is the project number and AA is the base drawing type (standard across all projects), you'd rename the XREF to just be AA. Any layer state created using AA|* would then be able to export/import into another project and still apply (setting aside that some projects may have purged layers, linetypes, etc). 

 

HTH


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes