@Kent1Cooper wrote:
As long as no one gets into the XPLAN drawing itself and Purges Layers there, those Xref-dependent Layers shouldn't go missing, because people can't Purge Xref-dependent Layers from the drawings into which XPLAN is Xref'd, even if they have nothing drawn on them in XPLAN.dwg. As for the non-Xref-dependent Layers, I would try this: Have nothing actually drawn in that XPLAN drawing, but just the Layers [and whatever else you may need in all such drawings, like Text and Dimension Styles, maybe some Block definitions, etc.]. Put something into the acaddoc.lsp file that Inserts that drawing with the asterisk prefix so it's pre-Exploded, meaning there won't be any need to Erase it and Purge its definition. It will be Inserted every time a drawing is opened, bringing with it any standard Layers [etc.] that may have been Purged before. That won't prevent people from Purging Layers, but their doing so won't survive getting out of the drawing, because when anyone gets back into it, those Layers will be restored.
The thing is they are going into the xplan & purging layers. We use a template file that has all the layers in it. This drawing gets copied into every project directory & becomes the xref for every porject. In this file we have walls, windows,doors ,etc. When you open up the architectural floor plan drawing you see for instance "A-DOOR-EXT-NEW" as well as XPLAN|A-DOOR-EXT-NEW. If for instance in a particular project we dont have any new exterior doors & someone runs the purge command those layers are removed. My viewports are set up either to freeze or thaw that particular layer. When someone purges this layer the viewports get messed up & i have to reset them. I want the viewports to remain the same & have the exact layers in them no matter what project is being worked on. My idea was to write a lisp routine that will open up this template file & insert a point at 0,0 for every layer that is in the template but i am a little foggy on database manipulation. Here is what i have so far. i could manually open up the drawing & then run the routine but i was trying to learn how to do this from within another drawing with something like findfile or something. The drawing would be on our network so it would be something like
(findfile "H:\\Overlays\\client\\XPLAN.dwg")
then open up the drawing & create a list of all the layers in the drawing & put a point on all of the layers at 0,0
(defun C:LAYRLST()
(setq all_layers (tablelist "LAYER"))
(mapcar 'add_list all_layers)
(foreach n '(all_layers)
(command "point" 0,0)
);end foreach
);end DEFUN
or something like this (although im not sure how to get into a specific drawing):
(vl-load-com)
(setq acad (vlax-get-acad-object))
(setq layers (vla-get-layers (vla-get-activedocument acad)))
(vlax-for eachLayer layers
(princ (vla-get-name eachLayer))
(terpri)
)
I guess i ned some help on database manipulation. What i want to do is open up this drawing either with lisp or manually, get a list of all the layers & put a point on each at 0,0. but i am unsure how to write the code to do this.