Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / disable layer creation in active scene when adding new xref files?
  RSS 2.0 ATOM  

disable layer creation in active scene when adding new xref files?
Rate this thread
 
14182
 
Permlink of this thread   Subscribe to this thread
avatar
  • epu
  • Posted: 07 July 2008 05:40 PM
  • Location: Chicago, IL
  • Total Posts: 16
  • Joined: 26 October 2007 11:28 PM

Hey users and staffers,

In 3dsmax 2009,

Since loadMaterialLibrary function does not accept a .max file argument string (although the material editor allows it),
as a work around, I wrote a function that:
* adds a file as an xref scene using xrefs.addNewXRefFile
* reads in its materials
* deletes that xref scene.

Unfortunately, if I employ this in a loop over a large list of scenes, I end up with my original scene
having a copy of every layer from every xrefscene I referenced and deleted.

In some simple tests, layermanager.count is as high as 76 (76 empty layers) when I am done.
But I am sure in my production environment, our staff could find a way to make that much higher.

I have 4 questions:

1. is there a built in, documented or undocumented method, by which I can load a .max file as a material library?
(if so, I can skip using my function)

2. is there a way to disable automatic importing of layers when I xrefscene a .max file?
(if so, I can disable that and continue happy).

3. if neither 1 nor 2, are the left-over empty layers considered a bug or a feature of the layermanager and xrefscene nodes?

4. if neither 1 nor 2, is there a better work around? Since I have to pay most of the cost of loading the scene anyways, I am open to ideas.

Best regards,

-epu



Replies: 0
avatar

I use this all the time to clean up cad layers ;) .. the deletelayerbyname will only delete empty layers.. so its safe to try it on everything in the list.

--Delete all layers that have no objects in them and are not the current layer

LayDelete 
#()
for 1 to (LayerManager.count-1) do 
(
    
append LayDelete (LayerManager.getlayer i).name
)
print 
LayDelete
for 1 to LayDelete.count do
(
    
LayerManager.deleteLayerByName LayDelete[i]
)


Dave Buchhofer.

Replies: 0
avatar
  • epu
  • Posted: 09 July 2008 06:33 PM

Thanks, you’re right!
Empty layers can be cleaned easily.

Hopefully the bugs and features can get addressed in another version of 3dsmax.



Replies: 0




   
  Settings Choose Theme color: