我需要一个在特定标签之前运行自定义功能的JS挂钩。我在互联网上搜索,但找不到任何解决方案。
for arc in arcs:
if arc.dxf.color == 4:
if arc.dxf.center[1] > centerPoint[1]:
modelspace.add_arc( (arc.dxf.center), (arc.dxf.radius + offset), (arc.dxf.start_angle), (arc.dxf.end_angle), dxfattribs=newBoundaryLineAttribs )
else:
modelspace.add_arc((arc.dxf.center), (arc.dxf.radius - offset), (arc.dxf.start_angle),
(arc.dxf.end_angle), dxfattribs=newBoundaryLineAttribs)
if arc.dxf.color == 1:
arcPoints = ezdxf.math.arc_to_bulge(arc.dxf.center, arc.dxf.start_angle, arc.dxf.end_angle, arc.dxf.radius)
if arcPoints[0][0] < centerPoint[0]:
startPointX = arcPoints[0][0] - 3
else:
startPointX = arcPoints[0][0] + 3
if arcPoints[0][1] < centerPoint[1]:
startPointY = arcPoints[0][1] - 3
else:
startPointY = arcPoints[0][0] + 3
if arcPoints[1][0] < centerPoint[0]:
endPointX = arcPoints[1][0] - 3
else:
endPointX = arcPoints[1][0] + 3
if arcPoints[1][1] < centerPoint[1]:
endPointY = arcPoints[1][1] - 3
else:
endPointY = arcPoints[1][1] + 3
newStartPoint = [startPointX, startPointY]
newEndPoint = [endPointX, endPointY]
newArc = ezdxf.math.bulge_to_arc(newStartPoint, newEndPoint, arcPoints[2])
arc.dxf.start_angle = newArc[1]
arc.dxf.end_angle = newArc[2]