Silk: a NURBS workbench

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

for the sake of people who may be interested in the topic, but do not regularly check the users showcase forum, i will link here some recent posts that you may find interesting (in reverse chrono order):

a surfboard fin
viewtopic.php?t=78689

a boaty boat thing named boaty McBoatface
viewtopic.php?t=78525

a weird and fun bifurcating pipe thing (working on someone else's models)
viewtopic.php?p=675551#p675551

an old fashioned smoking pipe (working on someone else's models)
viewtopic.php?p=671788#p671788

a grip on a steering wheel
viewtopic.php?p=486716#p486716

producing tube caps and other high quality 'rotating' triangle surfaces (like the tip of the surfboard fin)
viewtopic.php?p=566151#p566151

a very compact model of an otherwise challenging design (working on someone else's models)
viewtopic.php?p=521702#p521702

an example of the flexibility of the 'rotating' triangles surface cap (NURBS sphere logic applied to non-circular edges, with fully 3D edges around the cap)
Rafael_01_01.png
Rafael_01_01.png (144.29 KiB) Viewed 1679 times
Rafael_01_02.png
Rafael_01_02.png (110.56 KiB) Viewed 1675 times
Rafael_01_03.png
Rafael_01_03.png (168.82 KiB) Viewed 1675 times
Rafael_01_04.png
Rafael_01_04.png (120.98 KiB) Viewed 1675 times
Rafael_01_05.png
Rafael_01_05.png (69.13 KiB) Viewed 1675 times
symmetry helps a lot here, but is not necessary. all 4 sides could be different surfaces from different guide curves (shared in pairs along the edges of course)
User avatar
michacassola
Posts: 23
Joined: Fri Feb 17, 2023 10:17 am
Contact:

Re: Silk: a NURBS workbench

Post by michacassola »

@emills2,

WOOW!!! You seriously rock!

I am super busy with other things today at work, I will need a bit of time to go through everything.
But first things first: Thank you very much for your help!
It's not even help, it feels like a Masterclass!
Thanks a lot!
User avatar
michacassola
Posts: 23
Joined: Fri Feb 17, 2023 10:17 am
Contact:

Re: Silk: a NURBS workbench

Post by michacassola »

@emills2

So I went through the tutorials and am thinking about a workflow with Draft Points to be able to always transform them and change the attached Sketches and therefore the CubicSurfaces.

However I enabled the zebra tool after one tutorial and get these bad results, how do you get things smooth?
Screenshot 2023-06-06 112559.png
Screenshot 2023-06-06 112559.png (578.16 KiB) Viewed 1518 times
User avatar
michacassola
Posts: 23
Joined: Fri Feb 17, 2023 10:17 am
Contact:

Re: Silk: a NURBS workbench

Post by michacassola »

Also, after trying around a bit, I can see blending two surfaces with splitting curves and so on is very nice, but I cannot figure out a way to get two 4x4 surfaces next to each other that are already smooth... Is that also not intended, will I first have to overshoot with construction and then blend blend blend, like in the example?
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

michacassola wrote: Tue Jun 06, 2023 9:30 am how do you get things smooth?
Curves WB Zebra is based on the current precision of the graphic representation (the model objects are more or less perfect in abstraction)

select the curve or surface, under properties, view tab, reduce the values of:
-angular deflection (1 degree, ok to leave it at this value long term)
-deviation (reduce to 0.01 or 0.05 temporarily).

after checking the surface, put deviation back up to 0.1 at least, because it really slows down FreeCAD. Silk recalculates all surfaces when you change a parameter. this is basically instantaneous...until you draw the shape on screen, and now precision matters (and can lock up your machine for minutes at a time). so after checking a seam, there isn't much reason to show it as perfect all the time.

once you are done with everything, set the final surfaces back down to very low deviation. the deviation value of an intermediary surface or curve does not affect the precision of objects that are built upon it. these values strictly affect graphical representation. all objects can be calculated to near infinite precision individually
ControlGrid44_01_01.PNG
ControlGrid44_01_01.PNG (268.79 KiB) Viewed 1455 times
Last edited by emills2 on Tue Jun 06, 2023 8:01 pm, edited 1 time in total.
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

michacassola wrote: Tue Jun 06, 2023 9:30 am So I went through the tutorials
michacassola wrote: Tue Jun 06, 2023 12:40 pm a way to get two 4x4 surfaces next to each other that are already smooth...
DING DING DING! Congratulations adventurer, these are the magic words that unlock tutorial 02.5! It only took 6 years since i wrote tutorial .03 for the question to be asked directly (several users figured this out by themselves though).

The reason i didn't go into this until explicitly requested is that unless you are 'primed' for the explanation, it will likely appear discouragingly obtuse. So I just skipped ahead and said "look, just blend away the hard edges, automatic G2". You are now in a position to judge accurately for yourself if direct G1 is something you want to deal with, or skip to blending.

now i just have to write it up...i have a test model ready, and all the pictures i need. I think i should have it posted here sometime today (working now).
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

michacassola wrote: Tue Jun 06, 2023 12:40 pm way to get two 4x4 surfaces next to each other that are already smooth...
Tutorial 0.25 - manually aligning tangency (G1) across the shared seam of two adjoining surfaces.

(i've decided to do videos from now on for tutorials, but who knows when i'll actually do it. so for now, here is a text and picture answer to your question)

With Silk you can align two adjacent grids/surfaces of type 4X4 to tangency (G1), this is built-in to the sketch>poly>grid>surface pipeline. Whether or not that is 'smooth' is debatable and depends on situation. In the general case, the answer is NO, merely reaching G1 is not acceptable.

G1 across a mirror plane tends to look good. Also, if the curves were harmonious, and looked good already with fine sharp creases, a small adjustment to G1 can look better.

Unfortunately, we can often have something nice, but creased slightly, and following the G1 rules distorts it and makes it ugly.

On disharmonious or severely distorted edge curves, G1 is attained but still looks like a visual flaw. this is where cutting and blending is needed to achieve G2, continuous curvature. In the long run, it's better to assume everything will be blended, and to be pleased when, on occasion, blending can be skipped with a good result.

it is still worth learning the rules for G1, because sometimes it's good enough, and it is key to some very advanced stuff (which won't be covered here). When we do G2 blends, we get some design freedom back, because we can ignore the G1 rules (blending automatically does G1+G2 for you).

(read the rule, move on right away, it'll make more sense on a second read through)
G1 RULE for all NURBS :
-poly/grid lines going across a join must be colinear (parallel and touching at endpoints)
-the length of poly/grid lines going across a join must maintain a constant ratio across the join (in pairs)

in Silk, you control this entirely from the edges, by aligning the sketch lines (3L and nodes), and setting their lengths. so if your sketches connect, and the lengths follow the proportion/ratio rule, applying the rule within the grid is automatic. G1 ready sketches > G1 surfaces.

First let put together the bare minimum to work with: two surfaces side by side, which are built using a common edge between them. We'll draw them first with no concern for tangency, and then adjust them. don't try to be perfect in form right off the bat, Silk is made to design with, not just model an existing design. The structure must match exactly, but the details do not matter yet.

Here i drew a sketch on YZ. i drew three lines in sequence, and closed the sketch (3L sketch). I copied the sketch, pasted it twice, and adjusted placement in +X for one copy, and -X for the other copy (orignal copy left on YZ plane). then i edited all the sketches, and moved the points around so each sketch is wildly different from the others.
ControlGrid44_01_02.png
ControlGrid44_01_02.png (14.41 KiB) Viewed 1365 times
.
then i drew a node sketch (N sketch) on XY, right at the origin (center of circle and one point of the line at origin)
ControlGrid44_01_03.png
ControlGrid44_01_03.png (14.9 KiB) Viewed 1365 times
.
then i copied and pasted this node sketch 6 times, and mapped the copies to all the endpoints of the 3L sketches (i kept the original node sketch right at the origin, and hid it. this way, i can make more copies later if i want to).

The mapping i used (6 times) is:
-select endpoint (from 3L sketch)
-select edge connected to endpoint (from 3L sketch)
-set mode: normal to edge.

there are a bazillion mappings you could use, but this is a great start for 3D work. the nodes can now spin around 360 degrees, normal to the 3L sketches. after mapping, i edited the ones on the right side so they point back towards the middle.
ControlGrid44_01_04.png
ControlGrid44_01_04.png (17.4 KiB) Viewed 1365 times
.
i need two more nodes sketches in the middle, so i can point then backwards to the left. i could map the same node sketch again twice, but here there is a useful shortcut. i already know that these nodes can be in the same plane as the middle node skteches i already have. so i select the existing node sketch, create new sketch, accept objectXY as the mapping. draw the circle and line, point them kinda backwards. i do this front and back on the middle 3L sketch. notice that the middle nodes share planes, but there are not otherwise aligned.
ControlGrid44_01_05.png
ControlGrid44_01_05.png (19.31 KiB) Viewed 1365 times
this is all the sketching we need, in terms of structure. editing these will get us what we're after.

make the polys. one per 3L sketch, one for each pair of node sketches.
ControlGrid44_01_06.png
ControlGrid44_01_06.png (18.98 KiB) Viewed 1365 times
.
[continued]
Last edited by emills2 on Wed Jun 07, 2023 4:04 am, edited 4 times in total.
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

make the two grids, make sure to select polys counterclockwise in a loop as you do.
(i turned the sketches back on here, they were in the way when i wanted to show the polys)
ControlGrid44_01_07.png
ControlGrid44_01_07.png (29.02 KiB) Viewed 1359 times
.
and put some surfaces on the grids
ControlGrid44_01_08.png
ControlGrid44_01_08.png (136.92 KiB) Viewed 1359 times
.
okay, this is nicely pinched, so we'll be able to see the changes as we make them G1 (simple tangency)

i edit the left pointing node in the back. i create a reference to the right pointing node line
ControlGrid44_01_09.png
ControlGrid44_01_09.png (188.27 KiB) Viewed 1359 times
.
and snap the the left pointing line parallel to it
ControlGrid44_01_10.png
ControlGrid44_01_10.png (170.54 KiB) Viewed 1359 times
[continued]
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

now we do the same thing thing in the front

edit left pointing node, make reference to right pointing node
ControlGrid44_01_11.png
ControlGrid44_01_11.png (164.62 KiB) Viewed 1352 times
.
snap parallel
ControlGrid44_01_12.png
ControlGrid44_01_12.png (165.3 KiB) Viewed 1352 times
are we G1 yet? actually surprisingly close, but not quite
.
ControlGrid44_01_13.png
ControlGrid44_01_13.png (325.4 KiB) Viewed 1352 times
we have not set the constant ratio going from one side to the other. blue to red in the picture below must have equal proportion in the front, and in the back
ControlGrid44_01_14.png
ControlGrid44_01_14.png (198.13 KiB) Viewed 1352 times
emills2
Posts: 868
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Post by emills2 »

we're going to set length in red, and match ratios on blue.

set back red 15 mm (close to where it already was). still free to rotate the line.
ControlGrid44_01_15.png
ControlGrid44_01_15.png (221.75 KiB) Viewed 1334 times
.
set back blue to 10 mm. now the ratio is set. 15:10 -> 3:2
ControlGrid44_01_16.png
ControlGrid44_01_16.png (115.11 KiB) Viewed 1334 times
.
go to red sketch on front side (points right), set length 30 mm. still free to rotate.
ControlGrid44_01_17.png
ControlGrid44_01_17.png (213.07 KiB) Viewed 1334 times
.
go to blue sketch in front, set length 20 mm (30:20 -> 3:2)
ControlGrid44_01_17_2.png
ControlGrid44_01_17_2.png (139.38 KiB) Viewed 1334 times
so we set the ratios on the sketches, and Silk sets the ratios for the grid's internal control points automatically.

It doesn't look much different, but it is now G1. the zebra lines touch at the seam. it is strictly tangent. but it is not smooth. i'm intentionally using an extremely ugly model, so we can see the problem, and the limited value of G1.
ControlGrid44_01_18.png
ControlGrid44_01_18.png (292.76 KiB) Viewed 1334 times
Last edited by emills2 on Wed Jun 07, 2023 2:05 am, edited 1 time in total.
Post Reply