Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Cadkunde.nl
551 Views, 6 Replies

Understanding Vector2D and UnitVector2D

Hello,

 

 

I have a problem understanding how to use vectors in a sketch.

 

Situation:

My code creates a sketch in sheetmetals, projects the edges and then offsets those lines.

Currently, I want to make a centermark pattern on the offseted lines.

 

As a mechanical engineer, for me, a vector has a direction and a magnitude

 

But when you do transientGeometry.CreateVector2d then you have to fill in X and Y coords.

My brain says with that input you get a point, not a vector

And if i search in:

Dim vec as vector2d

you can find: vec.length

How does the vector get length from that input

 

Or is this perhaps an array of 2 x points and 2 y points? (but how is that done)

 

Also what is UnitVector2d compared to vector2d

 

I got weird results and I'm obviously missing some basics.

 

Help

 

 

So imagine what I want to create:

I have a sketchline, with any angle, and any length (But its always a straight line, no arc entities etc)

Based on the length of the line I determine how many holes, distance between holes and distance from edges. (got that working)

Then i want to create sketchpoints, measured from the startpoint of the sketchline in the direction of the sketchline (im stuck here)