OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

Naming Objects

Open thesourcerer8 opened this issue 7 years ago • 10 comments

I would like to be able to assign (programmatically) names to objects and have those names be used when exporting to X3D, STL, ... where the export formats support names, so that I can more easily reference the objects in X3D. Support for the animation capabilities of X3D would be great as well.

I have been asked to reassign this issue here: https://github.com/EinsteinsWorkshop/BlocksCAD/issues/17#issuecomment-308742189

thesourcerer8 avatar Jun 16 '17 08:06 thesourcerer8

@thesourcerer8 Thanks!

We'll see if this is possible, but think so.

z3dev avatar Jun 16 '17 09:06 z3dev

@thesourcerer8 can you help define what you would like the X3D file to contain? there's a lot of possibilities.

https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NamingConventions

https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#Meshes

I'm thinking that a DEF attribrutue could be added.

z3dev avatar May 02 '20 07:05 z3dev

Yes, a DEF attribute seems to be the way to do it.

thesourcerer8 avatar May 02 '20 08:05 thesourcerer8

Do you want names in another export format, like DXF?

z3dev avatar May 02 '20 12:05 z3dev

I think it would be a good idea to put the names in all the output formats that support them.

thesourcerer8 avatar May 02 '20 13:05 thesourcerer8

Support of 'name' attribute added to V2 DXF serializer. #684

z3dev avatar Sep 24 '20 04:09 z3dev

Comment... each serializer should provide a list of supported attributes, such as 'name' or 'class' or 'id'. In addition, these attributes need to be preserved by generalize(), possibly a new option.

z3dev avatar Apr 07 '21 04:04 z3dev

From the forum... concerning SVG serialization

'class' element for sure is interesting as it will ease styling. About 'id', yes it must be used carefully to ensure that each object has its unique id, generally I use names forged from data (line between triangle 23 and 111 has id 'L_23_111', etc.). 'name' is deprecated so it's maybe wise to avoid it, on very old js code I remember i used 'tag', as svg doesn't use it, as svg can use custom attributes, it can be anything. And it would be really great to have exported svg from jscad with such fine details, because it will allow rework those outputs with great ease.

z3dev avatar Apr 07 '21 04:04 z3dev

Support of 'id' and ‘class’ attributes added to V2 SVG serializer. #974

z3dev avatar Jan 23 '22 12:01 z3dev

Summary of serializers:

  • AMF TBD
  • DXF support for 'name' attribute #684
  • OBJ TBD
  • STL impossible as format does not support
  • SVG support for 'id' and 'class' attribute #974
  • X3D impossible to add names directly to entities
  • 3MF support for 'name' attribute #1036

z3dev avatar May 11 '22 12:05 z3dev

Closing this issue as the relevant serializers have been changed to support names, ids, etc.

z3dev avatar Aug 13 '22 10:08 z3dev