Results 1 to 7 of 7

Thread: Save layers as objects automatically

  1. #1

    Save layers as objects automatically

    Hello,

    I have a quick question, I searched the threads but couldnt find anything on it.

    Is there a way to do a save layers as objects for ALL the layers in one object automatically instead of going one by one? I looked for plugins for this but couldnt find anything.

    Thanks !

    Matt
    Matt :: Seattle, WA

  2. #2
    I'm not sure if you mean saving each layer as a different object or saving all the layers in the object into one object? but if you have every layer you want in the object in the foreground and then File-Save layers as object then itll put all the layers into one.
    I have a feeling you meant the first thing tho

  3. #3
    Registered User
    Join Date
    Jan 2004
    Location
    Massapequa Park, New York USA
    Posts
    130
    Don't know how you could automatically save out all of the layers as independent objects. Wouldn't you have to give them each a different file name, anyway?
    Bill C.
    Massapequa Park, NY USA

  4. #4
    try this:

    Code:
    @warnings 0
    
    main
    {
    	m = Mesh(0);
    	mfn = m.filename;
    	if(mfn == nil)
    		error("No active object.");
    	(d,p,f,e) = split(mfn);
    	fullLayers = lyrdata();
    	
    	for(i=1;i<=fullLayers.size();i++)
    	{
    		
    		
    		thisLayer = fullLayers[i];
    		ln = m.layerName(thisLayer);
    		if(ln == nil)
    			myFile = string(d,p,f,"_",i,e);
    		else
    			myFile = string(d,p,f,"_",ln,i,e);
    		
    		lyrsetfg(thisLayer);
    		copy();
    		new();
    		paste();
    		save(myFile);
    		close();		
    	}	
    }

    note: the script will suffix your object filename with "_layerName ", where "layerName" is the layer name (duh!). if your layer is unnamed, it will suffix it with the layer number.

    it will save the objects in the same directory as your original object. feel free the change the script to suit your needs, though.

    hopefully that's what you're looking for.
    "The hardness of God is kinder than the softness of men, and His compulsion is our liberation." - C.S. Lewis


  5. #5
    Thanks Faulkner !

    I will try the script, sounds like it might work



    bcicio : thats correct , I was looking for a way or a plugin that would save them sequentially, xx_1.lwo , xx_2.lwo, xx_3.lwo - which is what Faulkner posted I think

    Tnx

    Matt -
    Matt :: Seattle, WA

  6. #6
    Newbie Member
    Join Date
    May 2006
    Location
    earth
    Posts
    43
    faulknermano - hello;

    regarding mesh.layerName() method

    I do not see this metod mentioned in the Lscript Reference(pdf) and it is not being recognized by modeler;

    can you tell me anything about this method?

    thanks

    dsdsdsdsd

  7. #7
    hi, it is recognised in modeler. try this:

    Code:
    	
    	m = Mesh(0);
    	myName = m.layerName(1); // get layer 1 name
    	info(myName);
    remember that method is for Mesh Object Agents, and that you to specify a layer index to that method before it returns anything valid.


    PS: for a more complete documentation, look at the release notes. this my current reference:

    http://thespread.ghostoutpost.com/LSCRIPT_DOCS.zip
    "The hardness of God is kinder than the softness of men, and His compulsion is our liberation." - C.S. Lewis


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •