• 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
1 2 3 4 5 … 11 Next »
Scripting with Scheme and Python

 
  • 0 Vote(s) - 0 Average
Scripting with Scheme and Python

Pages (5): « Previous 1 2 3 4 5 Next »
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#21
10-02-2023, 07:59 AM
(10-02-2023, 07:39 AM)edb Wrote: Try the paths in the text boxes without double quotes.

It's working! Thank you very much!
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#22
10-03-2023, 08:46 AM (This post was last modified: 10-03-2023, 09:00 AM by ivla.)
Sorry but I come with yet another trouble. Simple python script for new shape creation does not create new shape.
Please help with troubleshooting.

Details:

Nothing in erlang console.

W3D log window:
wpc_scripting_shapes:command/3: bad return value: {shape,
                                                  {shape_from_script,
                                                    {{command_rec,
                                                      [["type","py"],
                                                      ["name","Test Shape"]],
                                                      "c:/Users/kav/Documents/new_shape_test/test_shape.py",
                                                      "py",[]},
                                                    []}}}

test_shape.py: (should generate 2x2 cube)

Code:
import w3d_e3d
import w3d_newshape
import sys
def mnewshape():
  mesh = w3d_e3d.E3DMesh()
  mesh.type = "polygon"
  mesh.vs = [(-1,1,-1),(-1,1,1),(1,1,-1),(1,1,1),(-1,-1,-1),(-1,-1,1),(1,-1,-1),(1,-1,1)]
  mesh.fs = [[0,1,2,3],[6,7,5,4],[1,0,4,5],[2,3,7,6],[0,2,6,4],[3,1,5,7]]
  e3d_o = w3d_e3d.E3DObject()
  e3d_o.obj = mesh
  e3d_o.name = "test mesh"
  nshp = w3d_newshape.NewShape()
  nshp.prefix = "test"
  nshp.obj = e3d_o
  o = nshp.as_output_list()
  o.write_list_out(sys.stdout)
w3d_main_function = mnewshape

test_shape.wscr:

type "py"
name ?__(1,"Test Shape")
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#23
10-03-2023, 04:11 PM (This post was last modified: 10-03-2023, 06:40 PM by edb.)
ivla Wrote:Sorry but I come with yet another trouble. Simple python script for new shape creation does not create new shape.
Please help with troubleshooting.

I tested it and it seems there has to be at least one parameter, a bug in the script plugin, which I'll try to find time to fix soon.

Add to test_shape.wscr:
Code:
params {
  param "unused" "0"
}

After that the error is further into parts where the E3D that was constructed might cause errors, I recommend trying with the simpler NewShape form which only takes fs and vs.

Code:
  nshp = w3d_newshape.NewShape()
  nshp.prefix = "test"
  ## nshp.obj = e3d_o
  nshp.fs = ...
  nshp.vs = ...

Here I notice a combine_half_edges error, which might mean one of the faces might be facing the other direction.
You'll need to change the first face:
[0,1,2,3]
to
[0,1,3,2]

And the vertices have to be floats, it can cause weird errors in wings if there are integers in the mesh:
[(-1,1,-1),(-1,1,1),(1,1,-1),(1,1,1),(-1,-1,-1),(-1,-1,1),(1,-1,-1),(1,-1,1)]
now
[(-1.0,1.0,-1.0),(-1.0,1.0,1.0),(1.0,1.0,-1.0),(1.0,1.0,1.0),(-1.0,-1.0,-1.0),(-1.0,-1.0,1.0),(1.0,-1.0,-1.0),(1.0,-1.0,1.0)]



EDIT: I forgot to mention about the main function:

Code:
def mnewshape():
might be better as:
Code:
def mnewshape(params, params_by_key, extra_params):
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#24
10-04-2023, 03:55 AM
Thank you, it works as expected.
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#25
10-11-2023, 10:30 AM
Profiled thread generator:

.zip   thread.zip (Size: 2.31 KB / Downloads: 2)

Currently only ISO/DIN13 profile.
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#26
10-11-2023, 10:42 AM (This post was last modified: 10-11-2023, 10:43 AM by ivla.)
Two questions about it:
1. How to select or even visual define in-place the thread profile if there will be more than one?
2. How to construct the thread ends? I don't like the current way (especially upper end).
edb
Offline

Member

Posts: 135
Threads: 16
Joined: Nov 2022
#27
10-12-2023, 10:58 PM
That looks great ivla.

The wscr doesn't yet have a way to choose from a list, I'd have to implement that.

You can add preview easily by adding to .wscr:
params_preview 1

I'm not sure of the best approach about the thread ends geometry, personally I'd probably try to triangulate it with a central point.
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,680
Threads: 184
Joined: Jun 2012
#28
10-13-2023, 07:33 AM
(10-11-2023, 10:42 AM)ivla Wrote: 2. How to construct the thread ends? I don't like the current way (especially upper end).
I don't know if that can help you to evaluate ways to construct it, but I just shared three type of bolts I've made starting from the Threads primitive (here).
I think that is something that require a good attention to get it right - I'm not sure that is possible to create and automatized way to build it for many cases.
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#29
10-13-2023, 09:12 AM (This post was last modified: 10-13-2023, 11:47 AM by ivla.)
(10-12-2023, 10:58 PM)edb Wrote: The wscr doesn't yet have a way to choose from a list, I'd have to implement that.
Thank you.
(10-12-2023, 10:58 PM)edb Wrote: try to triangulate it with a central point.
Looks as a good idea. I'll try.
ivla
Offline

Member

Posts: 64
Threads: 8
Joined: May 2023
#30
10-13-2023, 09:18 AM (This post was last modified: 10-13-2023, 02:54 PM by ivla.)
(10-13-2023, 07:33 AM)micheus Wrote: I think that is something that require a good attention to get it right
I think it can be done by defining separate profiles for the first and last vertical sections of the thread... I'll try it.
« Next Oldest | Next Newest »

Users browsing this thread: 2 Guest(s)

Pages (5): « Previous 1 2 3 4 5 Next »


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

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode