Created
May 24, 2018 18:26
-
-
Save sheetd/5af5dd3bdb0cb2fb52ceec85b5101509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates input curves based on point intersection (VIK) | |
let listAllCurves, listLocalCurves (List) | |
let ptCenter (Point) | |
let myCurve (Curve) | |
let i, k (Integer) | |
let P (Point) | |
let myAngle (Angle) | |
let listPointsUnsorted, listPointsSorted (List) | |
let F (Feature) | |
// Inputs | |
listAllCurves = Inputs\Curves.Query("Curve", "") | |
ptCenter = Inputs\PT_Center | |
listLocalCurves = NULL | |
// Filter out non-intersecting curves | |
i = 1 | |
k = 1 | |
for i while i <= listAllCurves.Size() { | |
myCurve = listAllCurves.GetItem(i) | |
// Check for Intersection | |
if distance(myCurve, ptCenter) == 0mm { | |
listLocalCurves.InsertItem(myCurve, k) | |
k = k + 1 | |
} | |
} | |
// Create unsorted point lists | |
i = 1 | |
for i while i <= listLocalCurves.Size() { | |
myCurve = listLocalCurves.GetItem(i) | |
// Create points | |
P = intersect(MGM_VIK_Node\Wireframe\Circle.3, myCurve) | |
P.Name = "PT_" + i | |
listPointsUnsorted.InsertItem(P, i) | |
// Measure angle from origin | |
myAngle = angleoriented(line(ptCenter, MGM_VIK_Node\Wireframe\PT_DirectionY), line(ptCenter, listPointsUnsorted.GetItem(i) ), direction(MGM_VIK_Node\Wireframe\PL_XY)) | |
//Notify("# at angle #", P.Name, myAngle) | |
// Assign attributes to point | |
P.SetAttributeReal("myAngle", myAngle) | |
//Notify("-->", P.GetAttributeReal("myAngle")) | |
} | |
// Created new sorted list based on Angle values | |
listPointsSorted = listPointsUnsorted.Sort(">", "Point", "Angle", "y=x.GetAttributeReal(\"myAngle\")") | |
i = 1 | |
for i while i <= listPointsSorted.Size() { | |
//Points | |
P = CreateOrModifyDatum("Point", MGM_VIK_Node\Wireframe\PTs , MGM_VIK_Node\Relations\KP_Wireframe\listPoints, i) | |
P = listPointsSorted.GetItem(i) | |
P.Name = "PT_" + i | |
// Curves | |
F = CreateOrModifyDatum("Curve", MGM_VIK_Node\Wireframe\CRV, MGM_VIK_Node\Relations\KP_Wireframe\listCurves, i) | |
F = line(ptCenter, P) | |
F.Name = "CRV_" + i | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment