As can be seen in this image, there are two blue curves 7.7m apart, and I’m attempting to discover a ‘X’ distance where each line’s start/end points are shifted by the same ‘X’ distance, resulting in these two curves with a specified offset distance between them. And I want to predefine the offset distance in the script so that just the ‘X’ distance varies. The image depicts the ideal circumstance, and I attempted to write a simple script. I could define the X and make the offset distance variable, but I couldn’t manage to do in reverse.
It may not be much use, but I’d like to attach a brief script I made for your reference…
Please help me find a solution to this problem. Thank you!
This is actually quite easy.
The trick is to set two planes that have the x axis coincident to the diagonal line, and the y axis in the world z direction.
Then you draw two sufficiently long parallel lines to define the left and right border.
You can then calculate the intersection of the right border with the rightmost diagonal plane, same for the left border and left-most diagonal plane. That should result in two points.
Take the right point and and move it some distance -d in the world y direction (downwards), and take the left point and move it distance d (upwards).
(Here I’m using d as the equivalent to your sketch x. )
Draw the corresponding lines.
Use a little bit of trigonometry to project the line onto its respective plane.
Connect the endpoints of the line and the projected line.
The bounding rectangle? Is it supposed to remain 2900 x 7700?
Or the ‘fixed’ offset?
If yes, why were you making the offset vary?
Or the length of the triangle base segments (2350)?
If yes, then why not ensure top and bottom segments of the bounding rectangle measure 2350?
So the offset does vary (to affect the X distance)? Wasn’t it supposed to be fixed? Topic title reads “offset curve with a fixed distance”
Weren’t you supposed to ‘discover’ this ‘X’ rather than define it?
I think, as you stated, this is ‘simple’ but the explanation is less simple than it should?
Sorry for the questionnaire - I want to help but I am dumb - I like what @martinsiegrist did though.
*(edit) therefore here’s my ‘inadequate’ version where the bounding rectangle is made first, the 2350 lines are determined (and kept at 2350) second, and ‘X’ is both determined and discovered third - hence the offset is fake, neither set nor fixed lol - maybe the only thing discovered - since I thought I understood but I didn’t, I took the liberty to do it this way. Offset with fixed distance.gh (14.8 KB)
Welcome to geometric relationships and constraints.
From OP’s description I interpreted that he wants to make x variable. From that I took a guess about which constraints he wants satisfied.