2021-03-20
12:43 PM
- last edited on
2021-09-14
09:44 AM
by
Noemi Balogh
Solved! Go to Solution.
2021-04-13 09:36 AM
poChannel = initaddonscope ("PolyOperations", "", "")
preparefunction poChannel, "CreateContainer", "inputContainer", ""
preparefunction poChannel, "SetSourceContainer", "inputContainer", ""
preparefunction poChannel, "CreateContainer", "resultContainer", ""
preparefunction poChannel, "SetDestinationContainer", "resultContainer", ""
dict polygon
polygon.isClosed = 1
polygon.useEdgeInfo = 0
i = 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 0.0
polygon.contour.edges.begPoint.y = 0.0
i = i + 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 3.0
polygon.contour.edges.begPoint.y = 0.0
i = i + 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 3.0
polygon.contour.edges.begPoint.y = 3.0
i = i + 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 0.0
polygon.contour.edges.begPoint.y = 3.0
i = 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 1.0
polygon.holes[1].edges.begPoint.y = 1.0
i = i + 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 1.0
polygon.holes[1].edges.begPoint.y = 2.0
i = i + 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 2.0
polygon.holes[1].edges.begPoint.y = 2.0
i = i + 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 2.0
polygon.holes[1].edges.begPoint.y = 1.0
preparefunction poChannel, "StoreDictPolygon", "polygon", polygon
iPen = 1
gosub "drawPolyOpPolygon"
dict polyline
polyline.isClosed = 0
polyline.useEdgeInfo = 0
i = 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 0.0
polyline.contour.edges.begPoint.y = -1.0
i = i + 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 2.5
polyline.contour.edges.begPoint.y = 2.0
i = i + 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 4.0
polyline.contour.edges.begPoint.y = 1.0
i = i + 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 6.0
polyline.contour.edges.begPoint.y = 4.0
iPen = 3
dict polygon : polygon = polyline
gosub "drawPolyOpPolygon"
preparefunction poChannel, "StoreDictPolyline", "polyline", polyline
dim resultIDs[]
nResult = CALLFUNCTION (poChannel, "ClipPolyline", "polyline polygon", resultIDs)
add2 0, 0.01
gosub "drawResultPlines"
del 1
closeaddonscope poChannel
end
"drawResultPlines":
for iResult = 1 to nResult
dict polygon
nVertices = callfunction(poChannel, "GetDestinationDictPolyline", resultIDs[iResult], polygon)
iPen = iPen + 1
gosub "drawPolyOpPolygon"
next iResult
return
"drawPolyOpPolygon":
! conversion to status-coded polygon
dim outflat[] ! declare returned array
polygon.hasClosingPoint = 0 ! always given without repeating the first point
call "ProfileConverter" parameters bProfileToPolyOp = 0,
bPolyOpDict = 1,
PolyOpPolygon = polygon,
returned_parameters nOut,
outflat
! put results
for i = 1 to nOut ! without closing point
k = (i - 1) * 3
put outflat[k + 1], ! x
outflat[k + 2], ! y
outflat[k + 3] + 1 ! status
next i
! draw polygon
pen iPen
poly2_b NSP / 3, 1 + 2,
iPen, 0,
get(NSP)
return
2021-04-06 09:37 AM
2021-04-06 01:42 PM
2021-04-06 01:57 PM
2021-04-08 10:32 PM
2021-04-13 09:36 AM
poChannel = initaddonscope ("PolyOperations", "", "")
preparefunction poChannel, "CreateContainer", "inputContainer", ""
preparefunction poChannel, "SetSourceContainer", "inputContainer", ""
preparefunction poChannel, "CreateContainer", "resultContainer", ""
preparefunction poChannel, "SetDestinationContainer", "resultContainer", ""
dict polygon
polygon.isClosed = 1
polygon.useEdgeInfo = 0
i = 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 0.0
polygon.contour.edges.begPoint.y = 0.0
i = i + 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 3.0
polygon.contour.edges.begPoint.y = 0.0
i = i + 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 3.0
polygon.contour.edges.begPoint.y = 3.0
i = i + 1
polygon.contour.edges.type = 0
polygon.contour.edges.begPoint.x = 0.0
polygon.contour.edges.begPoint.y = 3.0
i = 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 1.0
polygon.holes[1].edges.begPoint.y = 1.0
i = i + 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 1.0
polygon.holes[1].edges.begPoint.y = 2.0
i = i + 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 2.0
polygon.holes[1].edges.begPoint.y = 2.0
i = i + 1
polygon.holes[1].edges.type = 0
polygon.holes[1].edges.begPoint.x = 2.0
polygon.holes[1].edges.begPoint.y = 1.0
preparefunction poChannel, "StoreDictPolygon", "polygon", polygon
iPen = 1
gosub "drawPolyOpPolygon"
dict polyline
polyline.isClosed = 0
polyline.useEdgeInfo = 0
i = 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 0.0
polyline.contour.edges.begPoint.y = -1.0
i = i + 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 2.5
polyline.contour.edges.begPoint.y = 2.0
i = i + 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 4.0
polyline.contour.edges.begPoint.y = 1.0
i = i + 1
polyline.contour.edges.type = 0
polyline.contour.edges.begPoint.x = 6.0
polyline.contour.edges.begPoint.y = 4.0
iPen = 3
dict polygon : polygon = polyline
gosub "drawPolyOpPolygon"
preparefunction poChannel, "StoreDictPolyline", "polyline", polyline
dim resultIDs[]
nResult = CALLFUNCTION (poChannel, "ClipPolyline", "polyline polygon", resultIDs)
add2 0, 0.01
gosub "drawResultPlines"
del 1
closeaddonscope poChannel
end
"drawResultPlines":
for iResult = 1 to nResult
dict polygon
nVertices = callfunction(poChannel, "GetDestinationDictPolyline", resultIDs[iResult], polygon)
iPen = iPen + 1
gosub "drawPolyOpPolygon"
next iResult
return
"drawPolyOpPolygon":
! conversion to status-coded polygon
dim outflat[] ! declare returned array
polygon.hasClosingPoint = 0 ! always given without repeating the first point
call "ProfileConverter" parameters bProfileToPolyOp = 0,
bPolyOpDict = 1,
PolyOpPolygon = polygon,
returned_parameters nOut,
outflat
! put results
for i = 1 to nOut ! without closing point
k = (i - 1) * 3
put outflat[k + 1], ! x
outflat[k + 2], ! y
outflat[k + 3] + 1 ! status
next i
! draw polygon
pen iPen
poly2_b NSP / 3, 1 + 2,
iPen, 0,
get(NSP)
return
2021-04-13 05:39 PM
2021-04-13 07:17 PM