I’m working in a worksession combining 3 parts of a design.
Each parts has it’s own set of 2D parts laid out.
I expected to be able to select all these (so including referenced geometry) and export it.
Is it an option to make this possible?
Export selection including geometry selected in Worksession reference files?
Hi Willem- not that I know of - I guess the best you can do is copy-in-place all the referenced stuff (puts the copies in the active file) then export, and then undo a couple of times.
My second thought as well so tried that:
The copied geometry (either Copy Inplace or Ctr-C Ctrl-V) is all placed on the active layer. It appears only the geometry and no attributes are ‘transferred’.
Sorry for digging that topic out… but even 5 years later, that feature would be pretty useful
I work on architectural projects and I’m used to store the projects gridlines into a separate rhino file, which I attach to all other files of the project.
It becomes not so handy by exporting things for clients, as the grid won’t export. It would be really neat, if attached files could behave like all other layers and be exported with all the rest if selected.
@dale : any way to get this done via a custom Rhinocommon command? With Rhino.FileIO.File3dm or something?
Or maybe in a more bruteforce way with a rhinocommon command which executes Rhino commands (’_Export’), let say I have a worksession referencing 3 files (File1.3dm, File2.3dm, File3.3dm):
File1 is active on the worksession
I select all objects (File1 + referenced files) I want to export and store their id’s
I export selected objects from File1 in a temp 3dm file (tFile1)
I make File2 active, select relevant objects from the ids list, export them in temp file tFile2
@jeffoulet I think I’d see about getting all the object attributes, then copy the object into the current file and apply attributes, making the required layers and materials for it if necessary, then export all of the objects in the usual way. And then a big Undo or Delete after,if needed.
Quick and dirty test to copy objects from an attached file into the current one.
import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
id = rs.GetObject()
oref = sc.doc.Objects.Find(id)
attrs = oref.Attributes
geo = oref.Geometry
newId = sc.doc.Objects.Add(geo)
obj= rs.coercerhinoobject(newId)
sc.doc.Objects.ModifyAttributes(obj, attrs, True)
obj.CommitChanges()
Thank you for your kind help.
Copying the objects attributes works so far, but I’m still struggling to copy the original layer structure from the reference file into the current file.
Is there a pretty way to reproduce the nested layer structure in the active file and also copy their Attributes (Layer Color, Linewidth etc…)?
Here’s what I want to achieve prior exporting the objects:
I tried with ‘Layer.CopyAttributesFrom’ and doing loops through the referenced layers hierarchy, but I don’t achieve to maintain the parent-children relationship of the newly created layers.
Ok, I finally manage to write a command which does what I expect (see attached). I guess the code is pretty inelegant and not really effective, but it seems to work though.
Last problem: I don’t get the ‘Undo’ command to work from the C# command. I also tried with an alias, launching the _cExport command, and then the _Undo (’_cExport _Undo’), but it still remain unsuccessful.
Could someone please explain me why it won’t work?
Typing the Undo command manually after the cExport one also work fine…
Thanks, so there is no way to perform an Undo right after a command?
But still good to know: I always thought that the aliases/macro behave similar as if an human typed the commands. I also understand that the ’_cExport _Undo’ is not treated as two distinct commands and the Undo doesn’t know what have been changed until the alias completion.
Jumping in to echo this. I’m using worksessions for a large file and it seems worksessions are not supported in Lumion, which is our renderer of choice for current tasks. The best way to quickly overcome this would be to simply “bake” all geometry referenced in a worksession and maintain all original attributes. Any thoughts on this version of the issue?
I could not use/ execute any of the option above. I don’t know how to run them… They aren’t *.rvb not even *.py files… With this extension they give me errors…