A web feature

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Vincent B
Veteran
Posts: 4713
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

A web feature

Post by Vincent B »

I'm thinking about to build a web feature (I mean a web as a skeleton). The aim is to move lines depending themselves. Selecting and moves must be do on the 3D display for easier use. For example is to change positions of a dummy. (positions will can be saved).
But I'm not gift to write that. :roll: And I don't know anything about coin3D programming.
How to tackle my project? any help?
Attachments
Capture.JPG
Capture.JPG (20.75 KiB) Viewed 955 times
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: A web feature

Post by TheMarkster »

How about make a modeless dialog that stays on top instead of dragging in the 3D view? This seems easier for the coder and perhaps also for the user because dragging in the 3D view is very challenging. You need a working plane always when translating 2D x,y mouse movements to 3D x,y,z coordinates. This is very confusing and not very intuitive, IMO. My idea is to have Part::Vertex objects to be manipulated. The lines connecting them would automatically update on recompute to reconfigure themselves.

In Curves a Line object is available that makes a line between two vertices. Create Part::Vertex objects and lines between them such that when a vertex moves the line moves with it. No need for Coin or fancy mouse observers. Have a button for each direction. Maybe label them up, down, left, right, forward, backward. Maybe click moves 1mm, Alt+Click 100mm, Shift+Click 10mm, Ctrl+Click 0.1mm. The Line objects can be made non-selectable in the view tab or by manipulating the view object in python. That way only the vertices can be selected by the user.

FreeCAD's dragger tool could also be used to manipulate an individual vertex's position. Maybe have a drag button to activate it on the selected vertex. This would enable some dragging in the 3D view (but rotating a vertex does not have much effect unless something is attached to it). Select the object and run the command to bring up the dragger:

Code: Select all

Gui.Selection.clearSelection()
Gui.Selection.addSelection(App.ActiveDocument.Name,"Vertex")
Gui.runCommand("Std_TransformManip",0)
This might eliminate need for the modeless dialog. You can set the point size to some large value / change color to make them easier to see and drag by changing it in the view object. E.g. App.ActiveDocument.getObject("Vertex").ViewObject.PointSize = 6.

For the puppet being manipulated perhaps attachments could be used with attachment offset off to the left.

The sketcher cannot work in 3D, but you could use it to make a 2D version of the skeleton perhaps where all the limbs are in the same plane. Add a sketcher point object constrained coincidentally to each place you want a part::vertex. Create one Part::Vertex and use Draft Point array to make the array of Part::Vertex objects. Part::Explode compound on the array to get at the individual objects.
Snip macro screenshot-4f6532.png
Snip macro screenshot-4f6532.png (50.5 KiB) Viewed 785 times
Attachments
skeleton.FCStd
(19.13 KiB) Downloaded 33 times
Post Reply