Export selection from worksession

Hi,

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?

Thanks
-Willem

2 Likes

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.

-Pascal

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’.

-Willem

Added your ‘implied wish’ to the heap…

http://mcneel.myjetbrains.com/youtrack/issue/RH-28852

thanks,

-Pascal

2 Likes

Hi there,

Sorry for digging that topic out… but even 5 years later, that feature would be pretty useful :slight_smile:

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.

1 Like

Thanks, I’ve added your comment added to the bug track item above.

-Pascal

Thanks!

@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
  • similar process for File3
  • I merge all the temp Files together.

Would that process make sense?

@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()

-Pascal

Hi Pascal,

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:
image

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.

Any tip would be welcome…

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…

cExport.cs (8.1 KB)

1 Like

Hi @jeffoulet,

It is not possible to run the Undo command, using RhinoApp.RunScript from within another running command, as you’ve seen.

– Dale

Hi @dale ,

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?

Any good solution for this right now?

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…

jeffoulet How do i use this file?

Thank you in advance!

Hi,
I presume you are on windows?
You’ll need to start a new C# plug-in. Take a look at this:

Or you can transcribe that piece of code into python language, but I’m not totally sure it will work…

1 Like

Thank you jeffoulet.

Yes i’m on windows… I will need to install Visual Studio 2017 right?

Exactly

1 Like

Thank you jeffoulet

A post was split to a new topic: Undoing command modifications