Feature Request: 3D PDF Exporting to Asymptote format.

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by easyw-fc »

wmayer wrote: Tue Sep 08, 2020 10:02 am I found the problem. When using creaseAngle one must explicitly tell x3dom a list of duplicated points. Obviously it has no function implemented to do this on its own.
May be you could handle crease angle only when exporting directly, giving the result a nicer view, and keep the standard method for the mesh object... what do you think?
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by wmayer »

I have found a workaround to set crease angle for CAD models and even remove the invalid Normal node for mesh models
git commit 976867e71
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by easyw-fc »

wmayer wrote: Tue Sep 08, 2020 12:37 pm I have found a workaround to set crease angle for CAD models and even remove the invalid Normal node for mesh models
git commit 976867e71
a code Master without limits :D Chapeau!
chrisb
Veteran
Posts: 54144
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by chrisb »

:thumbsup:
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jruiz
Posts: 479
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by jruiz »

chrisb wrote: Fri Sep 04, 2020 6:05 pm
jruiz wrote: Fri Sep 04, 2020 5:17 pm I am afraid my English is not good enough for writing on the wiki.
Go for it! It is quite easy for a native speaker to correct some language mistakes you may make as long as the contents is ok. Much better than vice versa, who needs a brilliantly formulated and pleasantly to read page with wrong contents?
Hi, yesterday I created the wiki Exporting meshes to Asymptote code
I have to say that this is my very first wiki I ever made.
So, for sure, it will have many aspects to be fixed.
I'll appreciate any feedback.
Regards.
I have uploaded many FreeCAD video tutorials to my YouTube channel
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by easyw-fc »

wmayer wrote: Sat Aug 29, 2020 5:08 pm In the mesh settings for export you can set a custom width and height. Edit > Preferences > Import/Export > Mesh formats. See Asymptote section.
Hi Werner
I'm trying to export a shape to a mesh and then asy output using a python macro.
Here an example code:

Code: Select all

Gui.Selection.addSelection('Unnamed','Box')
Gui.activateWorkbench("MeshWorkbench")
Gui.getDocument('Unnamed').getObject('Box').ShapeColor=(0.61,0.96,0.07)
import MeshPartGui, FreeCADGui
# FreeCADGui.runCommand('MeshPart_Mesher')
import Mesh, Part, PartGui
import MeshPart
__doc__=FreeCAD.getDocument("Unnamed")
__mesh__=__doc__.addObject("Mesh::Feature","Mesh")
__part__=__doc__.getObject("Box")
__shape__=Part.getShape(__part__,"")
__mesh__.Mesh=MeshPart.meshFromShape(Shape=__shape__, LinearDeflection=0.1, AngularDeflection=0.523599, Relative=False,Segments=True)
__mesh__.Label="Cube (Meshed)"
del __doc__, __mesh__, __part__, __shape__

Gui.Selection.addSelection('Unnamed','Mesh')
Gui.runCommand('Mesh_Export',0)
Is there a way to pass to the code the 'Apply face colors to mesh' option, instead of having a grey output result?
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by wmayer »

Hi Maurice,
easyw-fc wrote: Thu Sep 17, 2020 2:43 pm Is there a way to pass to the code the 'Apply face colors to mesh' option, instead of having a grey output result?
Currently there is no easy way to do this via Python. In C++ the function highlightSegments() of the mesh view provider is invoked but this is not yet accessible via Python.

Only if your part has a uniform color you can apply it to the mesh:

Code: Select all

__mesh__.ViewObject.ShapeColor = __part__.ViewObject.ShapeColor
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by wmayer »

git commit e8b5cfced

Extend your script with:

Code: Select all

__part__.ViewObject.DiffuseColor = [(1.,0.,0.), (0.,1.,0.), (0.,0.,1.), (1.,1.,0.), (1.,0.,1.), (0.,1.,1.)]
__mesh__.ViewObject.highlightSegments(__part__.ViewObject.DiffuseColor)
Important is that the number of colors must match with the number of segments.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by easyw-fc »

wmayer wrote: Thu Sep 17, 2020 4:27 pm git commit e8b5cfced

Extend your script with:

Code: Select all

__part__.ViewObject.DiffuseColor = [(1.,0.,0.), (0.,1.,0.), (0.,0.,1.), (1.,1.,0.), (1.,0.,1.), (0.,1.,1.)]
__mesh__.ViewObject.highlightSegments(__part__.ViewObject.DiffuseColor)
Important is that the number of colors must match with the number of segments.
Fantastic! :)
Thx
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: 3D PDF Exporting to Asymptote format.

Post by easyw-fc »

jruiz wrote: Thu Sep 17, 2020 1:40 pm Hi, yesterday I created the wiki Exporting meshes to Asymptote code
I have to say that this is my very first wiki I ever made.
Thx, I'll try it soon.
Post Reply