How To Sketch On A Surface
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: How To Sketch On A Surface
How old is the video?
For which FC version was targeted?
What versions of FC and Curves WB are you using?
Without these info is simply hard to guess where it should be the problem, some guesses:
- A modified behaviour of some of the "actions" involved.
- A little details somewhere as "devil is in details".
- A glitch in FC or Curves WB.
- A problem with normal of the surface that will make thing behave wrongly. I had some problems when extruding (Part module) things too near the surface boundaries.
Not forgetting the usual case that could arise betwen the chair and computer keyboard and monitor sometimes it is a glitch in user memory that forgot to make some action. (Sadly it happens frequently to me and I spend hours catching this sort if bugs, but a code refactoring of humans is very hard to do. And there are no tools to debug human mind. )
Regards
For which FC version was targeted?
What versions of FC and Curves WB are you using?
Without these info is simply hard to guess where it should be the problem, some guesses:
- A modified behaviour of some of the "actions" involved.
- A little details somewhere as "devil is in details".
- A glitch in FC or Curves WB.
- A problem with normal of the surface that will make thing behave wrongly. I had some problems when extruding (Part module) things too near the surface boundaries.
Not forgetting the usual case that could arise betwen the chair and computer keyboard and monitor sometimes it is a glitch in user memory that forgot to make some action. (Sadly it happens frequently to me and I spend hours catching this sort if bugs, but a code refactoring of humans is very hard to do. And there are no tools to debug human mind. )
Regards
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: How To Sketch On A Surface
I have done the methods shown in the video on several occasions with expected results.
But, using them with the latest code and latest Curves WB, it works only with a sketch created by the Sketch on surface. Any attempt to use a user created sketch simply shows nothing.
@Chris_G in the attached file I did it each way. The Mapped_Sketch was created by Sketch on surface, the other Sketch was created with Sketcher. I tried creating the Sketch on different planes, didn't seem to change the result.
Edit: Hmm...appears to be that appimage. If I open the file in 33357 it doesn't show, but, if I do a recompute it's fine...
But, using them with the latest code and latest Curves WB, it works only with a sketch created by the Sketch on surface. Any attempt to use a user created sketch simply shows nothing.
@Chris_G in the attached file I did it each way. The Mapped_Sketch was created by Sketch on surface, the other Sketch was created with Sketcher. I tried creating the Sketch on different planes, didn't seem to change the result.
Edit: Hmm...appears to be that appimage. If I open the file in 33357 it doesn't show, but, if I do a recompute it's fine...
Code: Select all
OS: Ubuntu 22.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.0.33345 (Git) AppImage
Build type: Release
Branch: master
Hash: a3c4f4bb01f5201daf666852444a8f9c5adbda8d
Python 3.10.11, Qt 5.15.8, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods:
* Manipulator 1.5.0
* Defeaturing 1.2.0
* Help 1.0.3
* kicadStepUpMod 10.19.4
* Assembly3 0.12.0
* Curves 0.6.9
* DynamicData 2.46.0
* freecad.gears 1.0.0
* fasteners 0.4.56
* A2plus 0.4.60n
* Assembly4 0.50.2
* sheetmetal 0.2.63
* CurvedShapes 1.0.4
* lattice2 1.0.0
* QuickMeasure 2022.10.28
- Attachments
-
- SketchOnSurf.FCStd
- (19.57 KiB) Downloaded 16 times
Last edited by drmacro on Sat Jun 03, 2023 12:12 pm, edited 1 time in total.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: How To Sketch On A Surface
Your sketch is at Z = 5.0
By moving it back to Z = 0.0, Sketch_on_Surface works OK.
I don't know what is happening, but it seems the projection step of the algorithm is failing for non-default placements now, while it was working before.
Re: How To Sketch On A Surface
See my edit to my previous post.
No changes, just open and recompute in the current source.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: How To Sketch On A Surface
The year that the video was posted/created is 1 yr. ago. The version that was used is 0.19. I am using version 20.2, Rev. 29603(Git).onekk wrote: ↑Sat Jun 03, 2023 8:27 am How old is the video?
For which FC version was targeted?
What versions of FC and Curves WB are you using?
Without these info is simply hard to guess where it should be the problem, some guesses:
- A modified behaviour of some of the "actions" involved.
- A little details somewhere as "devil is in details".
- A glitch in FC or Curves WB.
- A problem with normal of the surface that will make thing behave wrongly. I had some problems when extruding (Part module) things too near the surface boundaries.
Not forgetting the usual case that could arise between the chair and computer keyboard and monitor sometimes it is a glitch in user memory that forgot to make some action. (Sadly it happens frequently to me and I spend hours catching this sort if bugs, but a code refactoring of humans is very hard to do. And there are no tools to debug human mind. )
Regards
You are correct, there is definitely potential for operator error (mass between the chair and the keyboard). But the series of steps
that is required for achieving this functionality only adds to this potential. A cleaner, linear, and more robust tool needs to be created
for achieving this functionality.
Can someone provide a tutorial in .pdf with clearly defined steps for achieving 'sketch on curve' results - no missing steps?
frcaduser
Last edited by frcaduser on Sat Jun 03, 2023 5:14 pm, edited 1 time in total.
Re: How To Sketch On A Surface
Probably Chris_G has done you some suggestion.
He and some few others have experimented a lot with surfaces.
My advices are very generic as I model mostly with scripting, so usually I have other problems related to normals and projections.
From these experiences the only thing I could tell is that is not a "cup of tea" as normals could be very different between sides of the "projected wire" and since there are projections involved and UV parameters generalized step by step instructions could or could not work in relation to the surface on which you want to project things.
If surface are smooth and with constant curvatures like cylinder sections projections are usually more easy and will not fail, if surface is very ondulated it is more difficult to obtain things, as underlying geometric calculation, that are done by the CAD kernel could present more critical points.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: How To Sketch On A Surface
Hello,
I was able to sketch on a surface by way of this video: https://www.youtube.com/watch?v=yV26cig0p4I
I edited the construction geometry (blue lines) to an approximate area as the cross-sectional area of the
object surface.
This method was sooo much easier and straight forward. However, still strange that the sketch has to be
perpendicular to the surface. The downside is that if you want to sketch an object on a precise area, it
will be more challenging because you have to translate the sketch by 90 degrees and because you don't
have the actual surface in front of you as you're creating the sketch. Btw, with this method the sketch
has to be drawn after you've created the new sketch file via the Curve > Sketch on surface
whereas with the previous proposed method, the sketch had to be drawn first.
frcaduser
I was able to sketch on a surface by way of this video: https://www.youtube.com/watch?v=yV26cig0p4I
I edited the construction geometry (blue lines) to an approximate area as the cross-sectional area of the
object surface.
This method was sooo much easier and straight forward. However, still strange that the sketch has to be
perpendicular to the surface. The downside is that if you want to sketch an object on a precise area, it
will be more challenging because you have to translate the sketch by 90 degrees and because you don't
have the actual surface in front of you as you're creating the sketch. Btw, with this method the sketch
has to be drawn after you've created the new sketch file via the Curve > Sketch on surface
whereas with the previous proposed method, the sketch had to be drawn first.
frcaduser
- Attachments
-
- curvedSurface_AlternateMethod.FCStd
- (55 KiB) Downloaded 9 times
-
- Veteran
- Posts: 3179
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: How To Sketch On A Surface
To get shapes projected onto an extruded BSpline without distortion, I needed additional steps. (You may not have noticed this problem unless you measured.)frcaduser wrote: ↑Sat Jun 03, 2023 7:01 pm
I was able to sketch on a surface by way of this video: https://www.youtube.com/watch?v=yV26cig0p4I
I edited the construction geometry (blue lines) to an approximate area as the cross-sectional area of the
object surface.
First the BSpline has to be discretized by arc-length, then interpolated. This is necessary because the mapping is done by the u, v coordinates on the face. In the extrusion direction ( a straight line) this mapping is linear and faithful, but in the BSpline direction it is not. This means that shapes will be distorted - the side-lengths of a square measured along the curves will not be equal without the discretize/interpolate step.
The other thing I needed to do was to make the side lengths of the construction rectangle in the mapped sketch equal to the (curvilinear) lengths of face. I eventually did this with expressions.
- Attachments
-
- sketchonsurfaceremap.FCStd
- (32.91 KiB) Downloaded 9 times
-
- Veteran
- Posts: 3179
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: How To Sketch On A Surface
@Chris_G
A small change in your SketchOnSurface coding would allow for a much more usable construction box when the surface is an extruded BSpline (or an offset thereof):
Then the workaround that MangoJelly proposes (and doesn't really work because he uses projected area) wouldn't be required.
A small change in your SketchOnSurface coding would allow for a much more usable construction box when the surface is an extruded BSpline (or an offset thereof):
Code: Select all
def build_sketch(sk, fa):
# add the bounding box of the face to the sketch
u0, u1, v0, v1 = fa.ParameterRange
if isinstance(fa.Surface, Part.Cylinder):
u0 *= fa.Surface.Radius
u1 *= fa.Surface.Radius
elif isinstance(fa.Surface, Part.SurfaceOfExtrusion) and isinstance(fa.Surface.BasisCurve, Part.BSplineCurve):
u0 = 0
u1 = fa.Surface.BasisCurve.length()
elif isinstance(fa.Surface, Part.OffsetSurface) and isinstance(fa.Surface.BasisSurface, Part.SurfaceOfExtrusion) and isinstance(fa.Surface.BasisSurface.BasisCurve, Part.BSplineCurve):
u0 = 0
u1 = fa.Surface.BasisSurface.BasisCurve.length()
addFaceBoundsToSketch([u0, u1, v0, v1], sk)
# elif isinstance(fa.Surface, Part.Cone):
# u1 = 0.5 * (fa.Edge1.Length + fa.Edge3.Length)
# addFaceBoundsToSketch([u0,u1,v0,v1], sk)
# elif len(fa.Edges) == 4:
# u1 = 0.5 * (fa.Edge1.Length + fa.Edge3.Length)
# v1 = 0.5 * (fa.Edge2.Length + fa.Edge4.Length)
# addFaceBoundsToSketch([0,u1,0,v1], sk)
# else:
# for w in fa.Wires:
# addFaceWireToSketch(fa, w, sk)
for i in range(int(sk.GeometryCount)):
sk.toggleConstruction(i)
- Attachments
-
- debugCurves.FCStd
- (14.67 KiB) Downloaded 5 times