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
jruiz
Posts: 292
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

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

Post by jruiz » Wed Aug 26, 2020 11:50 am

wmayer wrote:
Wed Aug 26, 2020 8:32 am
There are many examples but I couldn't find one where a 3D mesh (with materials) will be created.
I hope the following could help:
Last edited by Kunda1 on Wed Aug 26, 2020 1:02 pm, edited 1 time in total.
I have uploaded some FreeCAD video tutorials to
my channel at LBRY. If you don't have an account at LBRY, follow this invitation .
Most of the videos can be watched at my channel of youtube
wmayer
Site Admin
Posts: 16862
Joined: Thu Feb 19, 2009 10:32 am

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

Post by wmayer » Thu Aug 27, 2020 7:54 am

With git commit 4badaba52 you can export to an .asy file. At the moment this only works for meshes and you will find this function in the Mesh design wb under Meshes > Mesh export.
wmayer
Site Admin
Posts: 16862
Joined: Thu Feb 19, 2009 10:32 am

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

Post by wmayer » Thu Aug 27, 2020 10:56 am

With git commit 50bbd522 and git commit 58a92681 it's now possible to also export colored meshes. They can be colored by face or by vertex.
User avatar
jruiz
Posts: 292
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

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

Post by jruiz » Thu Aug 27, 2020 1:24 pm

wmayer wrote:
Thu Aug 27, 2020 10:56 am
With git commit 50bbd522 and git commit 58a92681 it's now possible to also export colored meshes. They can be colored by face or by vertex.
Great!
Want to make some tests, but (forgive my ignorance please) I'm not sure about what to do now.
Does the entire FreeCAD source have to be downloaded, then four files in[git commit 4badaba52] be substituted and then compile the FreeCAD source?

Realized that you added the four modified files of the FreeCAD code in wwmayer Mesh: [skip ci] improve support of asymptote export .
Now going to download it from and compile it.
Any hint?
Last edited by jruiz on Thu Aug 27, 2020 2:18 pm, edited 1 time in total.
I have uploaded some FreeCAD video tutorials to
my channel at LBRY. If you don't have an account at LBRY, follow this invitation .
Most of the videos can be watched at my channel of youtube
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

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

Post by vocx » Thu Aug 27, 2020 2:14 pm

jruiz wrote:
Thu Aug 27, 2020 1:24 pm
...
Does the entire FreeCAD source have to be downloaded, then four files in[git commit 4badaba52] be substituted and then compile the FreeCAD source?
Yes. Werner modified C++ code, so you can only get the new functionality if you recompile the entire source code with these additions.

This is not a very complicated procedure if you know what you are doing. But if you don't want to compile, then you can wait a day for the Ubuntu daily package to be generated; or wait a week, for the new AppImage, Windows and MacOS packages to be generated. Then you can test the new functionality there.

Compiling
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
jruiz
Posts: 292
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

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

Post by jruiz » Thu Aug 27, 2020 2:25 pm

vocx wrote:
Thu Aug 27, 2020 2:14 pm
jruiz wrote:
Thu Aug 27, 2020 1:24 pm
...
Does the entire FreeCAD source have to be downloaded, then four files in[git commit 4badaba52] be substituted and then compile the FreeCAD source?
Yes. Werner modified C++ code, so you can only get the new functionality if you recompile the entire source code with these additions.

This is not a very complicated procedure if you know what you are doing. But if you don't want to compile, then you can wait a day for the Ubuntu daily package to be generated; or wait a week, for the new AppImage, Windows and MacOS packages to be generated. Then you can test the new functionality there.

Compiling
Gonna try to compile it. Wanna see FreeCAD exporting to Asymptote. :D
If something fails I'll wait for the binary :cry:
I have uploaded some FreeCAD video tutorials to
my channel at LBRY. If you don't have an account at LBRY, follow this invitation .
Most of the videos can be watched at my channel of youtube
wmayer
Site Admin
Posts: 16862
Joined: Thu Feb 19, 2009 10:32 am

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

Post by wmayer » Thu Aug 27, 2020 3:13 pm

Here is the content of a simple cube where the six sides have different colors:

Code: Select all

/*
 * Created by FreeCAD <http://www.freecadweb.org>
 */

import three;

size(500);

// CA:Camera, OB:Camera
currentprojection = orthographic(camera = (15, 5, 5),
                                 target = (5, 5, 5),
                                 showtarget = false,
                                 up = (0, 0, 1));

// ME:Mesh, OB:Mesh
draw(surface((0, 10, 0)--(0, 0, 10)--(0, 10, 10)--cycle),
     rgb(1, 0.666667, 0));
draw(surface((0, 0, 0)--(0, 0, 10)--(0, 10, 0)--cycle),
     rgb(1, 0.666667, 0));
draw(surface((10, 0, 10)--(10, 10, 0)--(10, 10, 10)--cycle),
     rgb(0, 0, 1));
draw(surface((10, 0, 10)--(10, 0, 0)--(10, 10, 0)--cycle),
     rgb(0, 0, 1));
draw(surface((10, 0, 0)--(10, 0, 10)--(0, 0, 0)--cycle),
     rgb(0, 1, 0));
draw(surface((0, 0, 0)--(10, 0, 10)--(0, 0, 10)--cycle),
     rgb(0, 1, 0));
draw(surface((10, 10, 10)--(10, 10, 0)--(0, 10, 0)--cycle),
     rgb(0, 0.666667, 1));
draw(surface((10, 10, 10)--(0, 10, 0)--(0, 10, 10)--cycle),
     rgb(0, 0.666667, 1));
draw(surface((0, 10, 0)--(10, 10, 0)--(0, 0, 0)--cycle),
     rgb(0.333333, 0.666667, 0));
draw(surface((0, 0, 0)--(10, 10, 0)--(10, 0, 0)--cycle),
     rgb(0.333333, 0.666667, 0));
draw(surface((10, 10, 10)--(0, 10, 10)--(0, 0, 10)--cycle),
     rgb(1, 0, 0));
draw(surface((10, 10, 10)--(0, 0, 10)--(10, 0, 10)--cycle),
     rgb(1, 0, 0));
Save it as cube.asy.

To render the content: asy -V cube.asy
To create a PDF file: asy -f pdf cube.asy -o cube.pdf
User avatar
jruiz
Posts: 292
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

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

Post by jruiz » Thu Aug 27, 2020 3:58 pm

wmayer wrote:
Thu Aug 27, 2020 3:13 pm
Here is the content of a simple cube where the six sides have different colors:

Code: Select all

/*
 * Created by FreeCAD <http://www.freecadweb.org>
 */

import three;

size(500);

// CA:Camera, OB:Camera
currentprojection = orthographic(camera = (15, 5, 5),
                                 target = (5, 5, 5),
                                 showtarget = false,
                                 up = (0, 0, 1));

// ME:Mesh, OB:Mesh
draw(surface((0, 10, 0)--(0, 0, 10)--(0, 10, 10)--cycle),
     rgb(1, 0.666667, 0));
draw(surface((0, 0, 0)--(0, 0, 10)--(0, 10, 0)--cycle),
     rgb(1, 0.666667, 0));
draw(surface((10, 0, 10)--(10, 10, 0)--(10, 10, 10)--cycle),
     rgb(0, 0, 1));
draw(surface((10, 0, 10)--(10, 0, 0)--(10, 10, 0)--cycle),
     rgb(0, 0, 1));
draw(surface((10, 0, 0)--(10, 0, 10)--(0, 0, 0)--cycle),
     rgb(0, 1, 0));
draw(surface((0, 0, 0)--(10, 0, 10)--(0, 0, 10)--cycle),
     rgb(0, 1, 0));
draw(surface((10, 10, 10)--(10, 10, 0)--(0, 10, 0)--cycle),
     rgb(0, 0.666667, 1));
draw(surface((10, 10, 10)--(0, 10, 0)--(0, 10, 10)--cycle),
     rgb(0, 0.666667, 1));
draw(surface((0, 10, 0)--(10, 10, 0)--(0, 0, 0)--cycle),
     rgb(0.333333, 0.666667, 0));
draw(surface((0, 0, 0)--(10, 10, 0)--(10, 0, 0)--cycle),
     rgb(0.333333, 0.666667, 0));
draw(surface((10, 10, 10)--(0, 10, 10)--(0, 0, 10)--cycle),
     rgb(1, 0, 0));
draw(surface((10, 10, 10)--(0, 0, 10)--(10, 0, 10)--cycle),
     rgb(1, 0, 0));
Save it as cube.asy.

To render the content: asy -V cube.asy
To create a PDF file: asy -f pdf cube.asy -o cube.pdf
Cool!
I have uploaded some FreeCAD video tutorials to
my channel at LBRY. If you don't have an account at LBRY, follow this invitation .
Most of the videos can be watched at my channel of youtube
User avatar
jruiz
Posts: 292
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

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

Post by jruiz » Thu Aug 27, 2020 4:16 pm

wmayer wrote:
Thu Aug 27, 2020 3:13 pm
Here is the content of a simple cube where the six sides have different colors:

Code: Select all

/*
 * Created by FreeCAD <http://www.freecadweb.org>
 */

import three;

size(500);

// CA:Camera, OB:Camera
currentprojection = orthographic(camera = (15, 5, 5),
                                 target = (5, 5, 5),
                                 showtarget = false,
                                 up = (0, 0, 1));

// ME:Mesh, OB:Mesh
draw(surface((0, 10, 0)--(0, 0, 10)--(0, 10, 10)--cycle),
     rgb(1, 0.666667, 0));
draw(surface((0, 0, 0)--(0, 0, 10)--(0, 10, 0)--cycle),
     rgb(1, 0.666667, 0));
draw(surface((10, 0, 10)--(10, 10, 0)--(10, 10, 10)--cycle),
     rgb(0, 0, 1));
draw(surface((10, 0, 10)--(10, 0, 0)--(10, 10, 0)--cycle),
     rgb(0, 0, 1));
draw(surface((10, 0, 0)--(10, 0, 10)--(0, 0, 0)--cycle),
     rgb(0, 1, 0));
draw(surface((0, 0, 0)--(10, 0, 10)--(0, 0, 10)--cycle),
     rgb(0, 1, 0));
draw(surface((10, 10, 10)--(10, 10, 0)--(0, 10, 0)--cycle),
     rgb(0, 0.666667, 1));
draw(surface((10, 10, 10)--(0, 10, 0)--(0, 10, 10)--cycle),
     rgb(0, 0.666667, 1));
draw(surface((0, 10, 0)--(10, 10, 0)--(0, 0, 0)--cycle),
     rgb(0.333333, 0.666667, 0));
draw(surface((0, 0, 0)--(10, 10, 0)--(10, 0, 0)--cycle),
     rgb(0.333333, 0.666667, 0));
draw(surface((10, 10, 10)--(0, 10, 10)--(0, 0, 10)--cycle),
     rgb(1, 0, 0));
draw(surface((10, 10, 10)--(0, 0, 10)--(10, 0, 10)--cycle),
     rgb(1, 0, 0));
Save it as cube.asy.

To render the content: asy -V cube.asy
To create a PDF file: asy -f pdf cube.asy -o cube.pdf
I have to congratulate you. You made an excellent job in a very short time.
Now, as I see it, FreeCAD expanded its functionalities in the interchange of information.
I think it is a very good news.
Regards.
I have uploaded some FreeCAD video tutorials to
my channel at LBRY. If you don't have an account at LBRY, follow this invitation .
Most of the videos can be watched at my channel of youtube
User avatar
Kunda1
Posts: 9212
Joined: Thu Jan 05, 2017 9:03 pm

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

Post by Kunda1 » Thu Aug 27, 2020 5:10 pm

Noted in 0.19 forum thread for release notes: https://forum.freecadweb.org/viewtopic. ... 00#p426766
Alone you go faster. Together we go farther
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests