• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Design & Development v
« Previous 1 2 3 4 5 … 11 Next »
OpenJSCAD plugin - exporter

 
  • 0 Vote(s) - 0 Average
OpenJSCAD plugin - exporter

Pages (2): 1 2 Next »
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#1
11-25-2019, 11:39 PM
These days I found at Twitter someone (Gilb-r Duval) who uses Wings3D to create models which are turned into papercraft objects.

To do that he uses an intermediary program to convert the exported .obj into a .jscad which is the important format in the process. So, as it didn't seem to be hard to create an exporter I tried to create one and here is it: wpc_jscad.beam

It was made for v2.2.4. To install it just download the file and use the option at File->Install Plug-In or Path and find the plugin file where you download it.




This video shows his workflow (still with the extra step):
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
gilboonet
Offline

Junior Member

Posts: 13
Threads: 1
Joined: Dec 2019
#2
12-03-2019, 05:23 PM
Hello, I tried your plugin and it works fine to export polyhedron to jscad. It can already be very useful, but to be able to use it on my workflow, it needs to provide one more information : an array giving the group number of each face. Ideally a color would be enough, but the data available on obj format is material group, so I used it. I use this supplemental information to easily split the volume into separate parts to unfold separately, but the faces coloring could certainly find more uses.
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#3
12-12-2019, 05:13 PM
gilboonet, thanks for your feedback.
For some reason your post was not automatically approved and I was missing it.

I Attached my test file, so I would like you could to use it in your workflow and give me back the files you generated using it (.obj and .jscad). This way I can try to make the changes, add options and make possible the exporter to be more useful. Smile


Attached Files
.wings   jscad test.wings (Size: 2.85 KB / Downloads: 1)
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
gilboonet
Offline

Junior Member

Posts: 13
Threads: 1
Joined: Dec 2019
#4
12-13-2019, 01:40 PM
Hello, here is what I got when using your test file with my workflow.

I added materials from colors (select body, RMB, Vertex Attributes, Colors to Materials) then exported it to obj.

On the .jscad file, what I take from the materials is for each face the group where he belongs, and it is on the member called 'groups'. This information can be replaced by face color.


Attached Files
.txt   jscad_test_obj.txt (Size: 2.47 KB / Downloads: 2)
.txt   w3d_test_jscad.txt (Size: 2.06 KB / Downloads: 2)
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#5
12-13-2019, 05:10 PM (This post was last modified: 12-14-2019, 10:28 PM by micheus.)
Thanks for the files.

When I looked at the docs I was not sure about what we would need to export the objects, so I used the simple option. Smile

By looking into .jscad file it looks like something is missing once the main function statement is absent:

PHP Code:
function main() {
    return <
something>
} 


(12-13-2019, 01:40 PM)gilboonet Wrote: On the .jscad file, what I take from the materials is for each face the group where he belongs, and it is on the member called 'groups'. This information can be replaced by face color.
In this case, the .jscad file you send has a function which returns:
PHP Code:
return {faces:faces, vertices:vertices, groups:groups, faceCsg:faceCsg, csg:csg}; 
But, this seems to not be a valid object definition returned - at least using the https://openjscad.org/

So, maybe the site is limited or do your create a custom .jscad file for other application?
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
gilboonet
Offline

Junior Member

Posts: 13
Threads: 1
Joined: Dec 2019
#6
12-14-2019, 11:46 PM
Indeed, my workflow creates a .jscad file that is not standalone but is used as a library from another jscad script. That way I can use it with as input of another script.
It is meant to be used as follow :
include "file.jscad"

function main() {
let a = volume()
}

But it is even more complex because as include doesn't work on windows OS anymore, I changed my workflow by injecting the function () into the other jscad that uses it
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#7
12-15-2019, 12:05 AM (This post was last modified: 12-15-2019, 12:06 AM by micheus.)
So, if we have an export option to set the file to be used in a include that would to work. Right?!

And how those properties:values are used by jscad?

I'm just trying to enable the way you use, but keeping the content valid.
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#8
12-15-2019, 10:15 AM
Yesterday, after make the post above I realised that properties were arbitrary. You defined that. It's just JScript a sintax we can use.

So, the PM I sent you at Twitter is more pertinent. Smile
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
gilboonet
Offline

Junior Member

Posts: 13
Threads: 1
Joined: Dec 2019
#9
12-15-2019, 10:24 AM
Something like that could work

volume = function () {
let faces =[[1,12,3],[3,12,7],[5,14,1],[7,14,5],[12,1,13], ... ],
vertices = [[0.11063329,-0.83372273,-2.1072196],[0.11063329,-0.83372273,-0.1072196], ... ],
groups = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4],
faceCsg = faces.map(m => CSG.Polygon.createFromPoints(m.map(n => vertices[n]))),
csg = CSG.fromPolygons(faceCsg);
return {faces:faces, vertices:vertices, groups:groups, faceCsg:faceCsg, csg:csg};
};

function main () {
return volume().csg;
}
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#10
12-15-2019, 10:39 AM
Yeah. I did that yesterday before PM you. Including group colors too. I just needed to realise it's JScript code.

What I'm looking for is a way to avoid that unique volume attribution once we can be exporting multiple objects.
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode