Setting arc length of curves

Setting arc length of curves

baxternBEKUS
Explorer Explorer
616 Views
1 Reply
Message 1 of 2

Setting arc length of curves

baxternBEKUS
Explorer
Explorer

How does Formit determine the arc length to use when drawing curves and circles.  Following up on that, is there a way to select the number of facets for a given curve or arc so that when converting it to a faceted object, the facets match a desired architectural intent?

 

Thank you.

Ned 

0 Likes
Accepted solutions (1)
617 Views
1 Reply
Reply (1)
Message 2 of 2

josh.goldstein
Community Manager
Community Manager
Accepted solution

Hi Ned,

 

FormIt uses a hard-coded value when drawing curves and circles. This is something we should expose to users - it's definitely useful.

 

In the mean time, I wrote a JavaScript code snippet that you can use in FormIt for Windows to generate Arcs and Circles with the desired edge length along the curve to create the faceting.

 

- First, go to the Window menu, and check Script Output and Script Editor - you should see a new panel at the bottom of the application

- You might want to grab the top of one of the panels and drag it over the right side of the other one to create a split-screen effect like this:

 

console 1.PNG

 

 

 

 

 

 - Next, copy and paste the following code into the Script Editor panel:

 

console.clear();

// Get the current history
var nHistoryID = FormIt.GroupEdit.GetEditingHistoryID();

// USER: set radius
var radius = 50;

// USER: optionally set origin
var posCenter = WSM.Geom.Point3d(0,0,0);

var xAxis = WSM.Geom.Vector3d(1,0,0);
var yAxis = WSM.Geom.Vector3d(0,1,0);
var dStartParam = 0;

// USER: set arc length out of 1. 0.25 = quarter circle, 0.5 = half circle, 1.0 = circle
var arcLengthParameter = 0.5;
var arcLengthParameterPercentage = arcLengthParameter * 100;

// USER: set desired edge length for faceting
var edgeLength = 3;

var pi = 3.1415926535897932384626433832795;
var circumference = radius * 2 * pi;
var effectiveArcLength = circumference * arcLengthParameter;
var dEndParam = arcLengthParameter * (2 * pi);

// Number of facets in each 90 degree arc segment; if circle, 4x this amount
var accuracyORcount = Math.ceil(circumference / (4 * edgeLength));
var numberOfFacets = (arcLengthParameter / 0.25) * (accuracyORcount);

// Report what was created
console.log("Created an arc representing " + arcLengthParameterPercentage.toFixed(2) + "% of a circle with radius of " + radius + ", arc length of " + effectiveArcLength.toFixed(2) + ", and " + numberOfFacets + " facets inside History ID " + nHistoryID + ".");

WSM.APICreateCircleOrArc(nHistoryID, radius, posCenter, xAxis, yAxis, dStartParam, dEndParam, accuracyORcount);

In the comments (//) I tagged "USER" in a few of them - below these comments are the places you'll want to change the value to be what you need. These include:

- Radius

- Origin point (optional - will use 0,0,0 by default)

- Length of arc along the circle - from 0 to 1.0 - so 0.25 would be a quarter circle, 0.5 would be a half circle...

- Edge length faceting - the desired length between points along the curve - FormIt will get as close as it can given the radius and arc length

 

Once you're ready, hit the Play button on the top of the Script Editor panel. You'll see the curve drawn in canvas, inside whatever Group you're currently in, and the Script Output window will tell you what was generated, including the actual arc length using whatever units your sketch is set to: "Created an arc representing % of a circle, with a radius of r, arc length of a, and f facets inside History ID h."

 

If you need to generate more curves, simply move or delete the one previously generated. You can also extrude the generated curve into a surface - maybe this satisfies the architectural intent you're going for.

 

Hopefully this helps! Let me know if you have problems running/modifying the script, or if you need help changing its logic to work better for your needs.




Josh Goldstein
Senior Product Manager
0 Likes