[SOLVED]Maybe revolve is not the right tool for this action?

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!
Post Reply
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

[SOLVED]Maybe revolve is not the right tool for this action?

Post by mariwan »

I am trying and trying to figure out how revolve could do a similar extrusion (green part). It fails and I am not able to figure out how to do that. :cry:
The direction and Axis is not doing what I expect to do.
Don't know how to do that, Sweep might do that? not sure either.
If Revolve, or Sweep cannot do that .. what other tools are there? don't think there are any :|
Attachments
revolve.jpg
revolve.jpg (27.37 KiB) Viewed 2166 times
Last edited by mariwan on Fri Oct 22, 2021 9:07 pm, edited 1 time in total.
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Maybe revolve is not the right tool for this action?

Post by drmacro »

Revolve seems to work...
Attachments
RevolveExamp.FCStd
(27.97 KiB) Downloaded 34 times
Snip macro screenshot-08f03b.png
Snip macro screenshot-08f03b.png (122.28 KiB) Viewed 2148 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: Maybe revolve is not the right tool for this action?

Post by chrisb »

Looks like it is not the Revolve that doesn't work, but rather your modeling. Further help may be possible with mor - much more - details from your side.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Maybe revolve is not the right tool for this action?

Post by mariwan »

My WB is on the github. The tools is called (Design456_SmartExtrudeRotate) in the devbranch please.
I even have many videos showing the tool I am working on.
I extract the face selected, and that face should be extruded (using revolve) as the picture shown.
Now:
1-How should I calculate the axis?
2-How should I calculate the base?

I used normalVector as direction, I used subtraction of vectors from lower-edge and addition of the two vectors/2 . All seems to fail.
It works for Cube but not for any other faces it has an angle.
I am out of ideas really.
I tested sweep now.. Seems to works better. But I have to draw a hidden curve (circle that I decide the start-end angle) and sweep it. Might work better than revolve.
Don't know really how to fix that.
Please download the WB and try the tool by yourself to understand the problems I have.
and look at the video shown on my youtube channel.

Code: Select all

r=s.revolve(App.Vector(10,10,0),App.Vector(0,1,0), 360)
                          ^                   ^
I appreciate any ideas help me to solve this complex issue.
Last edited by mariwan on Sun Oct 17, 2021 8:24 pm, edited 1 time in total.
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Maybe revolve is not the right tool for this action?

Post by mariwan »

In that file, what does decide the radius of the rotation? Not sure how it calculates?
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Maybe revolve is not the right tool for this action?

Post by freedman »

The radius is the rotation axis. This can be a standard origin line or a dutum line. The Gui allows you to pick.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Maybe revolve is not the right tool for this action?

Post by TheMarkster »

Do you add the Part::Revolution object or do the revolve in python? If you add the object you can set its AxisLink property to a selected edge. It also needs a 2D object as its Source property. For that you can make a copy of the selected face (or a draft facebinder) and put that as a document object to serve as the Source. Workflow for user would be select Face and select Edge to serve as axis. He can then modify the Angle property afterwards or do it in your code.

Code: Select all

import Draft
selx = Gui.Selection.getSelectionEx()
face = selx[0].SubObjects[0]
edge = selx[-1].SubObjects[-1]
binder = Draft.makeFacebinder(selx[0])
rev = FreeCAD.ActiveDocument.addObject("Part::Revolution","Revolve")
rev.Source = binder
rev.AxisLink = (selx[-1].Object,selx[-1].SubElementNames[-1])
rev.Angle = 90
FreeCAD.ActiveDocument.recompute()

Usage: select first the face, then the edge to use as axis, then run macro. No error checking is done in the example code. Presumption is user has selected first face, then edge.
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Maybe revolve is not the right tool for this action?

Post by mariwan »

Thanks,
Actually, if you look to the videos I have, the user should select a face and the other actions I should do in my code. User only rotate the wheel and the face should be created.
To do so I have to :
1-Find the axis which should be the lower side of the selected face (last edge anti-clockwise) . That edge should be used as the Axis. How can I change edge to axis?
2-I need to find the direction. Direction when you have square is easy. If the face is on the normal (x,y,z) direction. But as soon as the face has a slope and has an angle I am lost. How can you get the direction?
If I can fix those two values, It is not a matter if I use python or the Part.Revolve . Both should work.
What I do, when user rotates the wheel, I change the angle for the revolve and I recreate the object. (either by changing it for Part.Revolve or to recreate if it is python revolve).

I wish to avoid allowing the user to click the edge. At least for this tool. I want to find it by my code. I might make another tool which you select and decide ho you revolve.

I have it working on some faces, but as soon as the face has other shapes than the cube .. It is failing (Pyramid, Dodecahedron ..etc)
Please if you can help me to find out how I should find the direction and the Axis .. would be grate.

FYI:
My extrusion works in finding the direction. The same tool uses that. But now you have to find the axis which is 90degree to the extrusion-direction, which I don't know how to find it.

Please look at my video you understand better.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Maybe revolve is not the right tool for this action?

Post by carlopav »

I think you should have a look at sheetmetal workbench bend tool...
follow my experiments on BIM modelling for architecture design
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Maybe revolve is not the right tool for this action?

Post by mariwan »

carlopav wrote: Mon Oct 18, 2021 9:44 pm I think you should have a look at sheetmetal workbench bend tool...
I have to thank you alot. You saved me :)
Yes, the direction is correct.
But I have problem with my wheel widget. I have to fix it. I tried many many things before I get to this point. It is hard .. and don't have time to work continuously. ..

Look at the video please but the wheel is totally failing ..the direction of the rotation only is correct not the wheel..

phpBB [video]
Post Reply