Placing points on a line according to a set of mathametical parameters

dynamo

#1

Hello There,

I have a question about placing points on a line according to a set of mathematical parameters

How can you divide a line according to these mathematical parameters. The red distance should be 300mm and the green distance should be <600.
Can you for example put a mathematical formula in a code block for example;

P0=Startpoint, P1=Startpointcurve+300, p2=(Endpointcurve-300), P3= Endpoint
P[4,5,6,7,8,]= Length ((P1=Startpointcurve+300)+(p2=(Endpointcurve-300))/ < 600

Something like this.

Sorry if I’ts a bit too vage, maybe you guys have tips to websites where there are better tips on how the code blocks work


#2

Use “Curve.ByIsoCurveOnSurface” node.


#4

@v.verboom

same as kulkul

Same as @Kulkul :slight_smile:

I love those Designscript code blocks

Marcel

t1 = (0…25…#5);
point1 = Point.ByCoordinates(t1<1>, t1<2>);
vector1 = point1.AsVector();
num2 = vector1.Length;
num3 = Math.Random(num2);
geometry1 = point1.Translate(0, 0, num3);
nurbsSurface1 = NurbsSurface.ByPoints(geometry1, 3, 3);
t2 = 0.63;
curve1 = Curve.ByIsoCurveOnSurface(nurbsSurface1, 1, t2);


#5

thanks for quick response I will try this


#6

Marcel thanks for the quick response, do you maybe have tips on creating those complex code blocks a website maybe


#7

@v.verboom

First of all the credits for this solution go to @Kulkul

What you do is
Select a few nodes in your graph and right click, then go for Node to Code.
This will give you the Designscript equivalent of the nodes.
It works best with the out of the box nodes.
Then study what you see.
If you do this regularly Designscript will get easier to read and you have made the first steps.

you can also read the Designscript guide and documentation.

http://dynamobim.org/learn/#res

Marcel


#8

Yes many thanks @Kulkul and thanks for the tip.
I’m gonna make the formula even more simpele now.

Do you maybe have an how to draw curves parallel to the opposite site?

This is the script I created.


#9

I reccomend retyping them afterwards, reducing the number of lines by using inline code when possible and changing out variable names so they make sense. This will help you learn better and allow for easier re-work in the future.