Curves workbench
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: Curves workbench
Rotation_Sweep needs current FreeCAD master.
It is not compatible with latest stable 0.20
It is not compatible with latest stable 0.20
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Curves workbench
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 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.
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 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.
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Curves workbench
Are the u,v isoCurves suitable?
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Curves workbench
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 thatedwilliams16 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
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.
Re: Curves workbench
Small bug:
select the sketch and make a profile give a bopalgo_c0 error.
select the sketch's edge, no error.
same error with joincurves but for both selecting.
select the sketch and make a profile give a bopalgo_c0 error.
select the sketch's edge, no error.
same error with joincurves but for both selecting.
- Attachments
-
- profile_bopalgo.FCStd
- (9.86 KiB) Downloaded 15 times
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Curves workbench
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.keithsloan52 wrote: ↑Fri Dec 02, 2022 7:00 pmQuite possibly, but I need them to be equally displaced in terms of the distances as measured on the surface, looking at the screen shot thatedwilliams16 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
does not look like the case.
Curves|Isocurves draw the lines. Its properties control how many etc.
What do you actually want to do?
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Curves workbench
Okay I have started work on a macro to process the IsoCurve.keithsloan52 wrote: ↑Fri Dec 02, 2022 7:00 pmQuite possibly, but I need them to be equally displaced in terms of the distances as measured on the surface, looking at the screen shot thatedwilliams16 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
does not look like the case.
How do I access the coordinates of the intersections?
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
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Curves workbench
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())
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Curves workbench
Sorry don't like the above, name GDMLEllipsoid is hard coded, different file the object name would be differentedwilliams16 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())
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))
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Curves workbench
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