Curves workbench

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Post by Chris_G »

Rotation_Sweep needs current FreeCAD master.
It is not compatible with latest stable 0.20
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Curves workbench

Post by keithsloan52 »

I would like to create a Nurbs surface with a number regular segments? Not sure if that is the correct term.
I would then like to use a macro that has as input the Nurbs <surface> and say a small regular <cube>.
The macro would then place a cube ( linked object) at the intersections of the segments

1) I tried to create a Nurbs surface by first selecting a Shape and creating a point cloud using the Points workbench but
the created surface was not very satisfactory see attached
Cloud_Test.FCStd
(163.97 KiB) Downloaded 18 times
2) I wish to create a surface that is like half an egg, open to suggestions of a better way. The requirement is that the segments are regularly placed in respect of the surface

3) Assuming I can somehow achieve the above, how do I access the intersection points of the segments(?). i.e. the macro has access to the surface object, how do I access the coordinates of the intersections?

Thanks

Not sure that segments is the correct term, what I am after is a surface with a regular grid with respect to the surface?
and then to be able to access the grid points in a macro.

Question : Is there a way of creating a point cloud from a surface? Would seem a fairer challenge than creating a nurbs surface from what is really two surfaces.
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Curves workbench

Post by edwilliams16 »

Are the u,v isoCurves suitable?
Screen Shot 2022-12-02 at 8.34.04 AM.png
Screen Shot 2022-12-02 at 8.34.04 AM.png (40.19 KiB) Viewed 880 times
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Curves workbench

Post by keithsloan52 »

edwilliams16 wrote: Fri Dec 02, 2022 6:35 pm Are the u,v isoCurves suitable?

Screen Shot 2022-12-02 at 8.34.04 AM.png
Quite possibly, but I need them to be equally displaced in terms of the distances as measured on the surface, looking at the screen shot that
does not look like the case.

How do I access the coordinates of the intersections?
Last edited by keithsloan52 on Fri Dec 02, 2022 8:07 pm, edited 1 time in total.
User avatar
Vincent B
Veteran
Posts: 4713
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Curves workbench

Post by Vincent B »

Small bug:
select the sketch and make a profile give a bopalgo_c0 error.
select the sketch's edge, no error.
:roll:
same error with joincurves but for both selecting.
Attachments
profile_bopalgo.FCStd
(9.86 KiB) Downloaded 12 times
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Curves workbench

Post by edwilliams16 »

keithsloan52 wrote: Fri Dec 02, 2022 7:00 pm
edwilliams16 wrote: Fri Dec 02, 2022 6:35 pm Are the u,v isoCurves suitable?

Screen Shot 2022-12-02 at 8.34.04 AM.png
Quite possibly, but I need them to be equally displaced in terms of the distances as measured on the surface, looking at the screen shot that
does not look like the case.
There is no coordinate system on a curved surface that preserves distances. That's why you can't make a map of the earth that preserves distances.


Curves|Isocurves draw the lines. Its properties control how many etc.

What do you actually want to do?
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Curves workbench

Post by keithsloan52 »

keithsloan52 wrote: Fri Dec 02, 2022 7:00 pm
edwilliams16 wrote: Fri Dec 02, 2022 6:35 pm Are the u,v isoCurves suitable?

Screen Shot 2022-12-02 at 8.34.04 AM.png
Quite possibly, but I need them to be equally displaced in terms of the distances as measured on the surface, looking at the screen shot that
does not look like the case.

How do I access the coordinates of the intersections?
Okay I have started work on a macro to process the IsoCurve.

When the macro processes the selection I can see the TypeId is Part::FeaturePython is there a clean way of determining that I am dealing with an IsoCurve?

With my GDML workbench any Part::FeaturePython object gets a Type set in the Objects.Proxy i.e Objects.Proxy.Type has the type of the FeaturePython.

The user can change Labels so I don't rely on them and specific properties would work but not great for code readability/understanding
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Curves workbench

Post by edwilliams16 »

You can create the curves directly

Code: Select all

doc = App.ActiveDocument
obj = doc.getObject("GDMLEllipsoid")
shp = obj.Shape
sub = obj.getSubObject("Face1")
surf = sub.Surface
umin, umax, vmin, vmax = sub.ParameterRange
nu = 20
ulist = [i*(umax - umin)/nu + umin for i in range(nu+1)]
for u in ulist:
    spl = surf.uIso(u)
    spl.segment(vmin, vmax)
    Part.show(spl.toShape())

keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Curves workbench

Post by keithsloan52 »

edwilliams16 wrote: Fri Dec 02, 2022 9:27 pm You can create the curves directly

Code: Select all

doc = App.ActiveDocument
obj = doc.getObject("GDMLEllipsoid")
shp = obj.Shape
sub = obj.getSubObject("Face1")
surf = sub.Surface
umin, umax, vmin, vmax = sub.ParameterRange
nu = 20
ulist = [i*(umax - umin)/nu + umin for i in range(nu+1)]
for u in ulist:
    spl = surf.uIso(u)
    spl.segment(vmin, vmax)
    Part.show(spl.toShape())

Sorry don't like the above, name GDMLEllipsoid is hard coded, different file the object name would be different

I want to be able to select an icocurve and another object and act upon those.

Macro currently looks like

Code: Select all

print(f"Iso Curves Macro")
doc = App.ActiveDocument
sel = Gui.Selection.getSelection()
if len(sel) > 0:
    iso = None
    surface = None
    for s in sel:
        print(s.TypeId)
        if s.TypeId == "Part::FeaturePython":
            print(dir(s))
            print(dir(s.Proxy))
I need to check that one of the item in sel is an isocurve and another is a another specific type.
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Curves workbench

Post by edwilliams16 »

keithsloan52 wrote: Fri Dec 02, 2022 9:41 pm
So, are you just trying to pick a point on the surface and put something there? Click on the ellipsoid, then

Code: Select all

sel = Gui.Selection.getSelectionEx()[0]
point = sel.PickedPoints[0]
surf = sel.SubObjects[0].Surface
u, v = surf.projectPoint(point, 'LowerDistanceParameters')
surf.value(u, v) # => location
surf.normal(u,v) # normal
surf.tangent(u, v) # tangent in u, v directions
Post Reply