3135 lines
84 KiB
Python
3135 lines
84 KiB
Python
import platform
|
||
import ctypes
|
||
from ctypes import *
|
||
from xmlrpc.server import DocXMLRPCRequestHandler
|
||
|
||
system = platform.system()
|
||
if system == "Windows":
|
||
pre = "./"
|
||
suff = ".dll"
|
||
else:
|
||
pre = "./lib"
|
||
suff = ".so"
|
||
|
||
libfile = ctypes.cdll.LoadLibrary
|
||
filename = pre + "GeometryCommand" + suff
|
||
|
||
command = libfile(filename)
|
||
|
||
|
||
# C语言结构体映射,与“GeometryCommand\GeoCommandPy.h”中ShapePara一一对应
|
||
class ShapePara(Structure):
|
||
_fields_ = [
|
||
("ID", c_int),
|
||
("name", c_char * 64),
|
||
("coorSysID", c_int),
|
||
("variableParaStr", c_char * 128),
|
||
("x1", c_double),
|
||
("y1", c_double),
|
||
("z1", c_double),
|
||
("x2", c_double),
|
||
("y2", c_double),
|
||
("z2", c_double),
|
||
("radius1", c_double),
|
||
("radius2", c_double),
|
||
("length", c_double),
|
||
("planeType", c_int),
|
||
("normalLength", c_double),
|
||
("isExists", c_bool),
|
||
("isFace", c_bool),
|
||
]
|
||
|
||
|
||
# 基础形状类,其他形状集成该类
|
||
class BaseShape:
|
||
def __init__(self):
|
||
self.para = ShapePara()
|
||
self.para.ID = -1
|
||
self.para.name = b""
|
||
self.para.coorSysID = 0
|
||
self.para.variableParaStr = b""
|
||
self.para.x1 = 0.0
|
||
self.para.y1 = 0.0
|
||
self.para.z1 = 0.0
|
||
self.para.x2 = 10.0
|
||
self.para.y2 = 10.0
|
||
self.para.z2 = 10.0
|
||
self.para.radius1 = 1.0
|
||
self.para.radius2 = 10.0
|
||
self.para.length = 10.0
|
||
self.para.planeType = 0
|
||
self.para.normalLength = 0.0
|
||
self.para.isExists = 0
|
||
self.para.isFace = 1
|
||
|
||
def setName(self, name):
|
||
self.para.name = bytes(name, encoding="utf-8")
|
||
|
||
def setEditID(self, ID):
|
||
self.para.ID = c_int(ID)
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.para.coorSysID = c_int(csid)
|
||
|
||
def setXYZ1(self, x1, y1, z1):
|
||
self.para.x1 = c_double(x1)
|
||
self.para.y1 = c_double(y1)
|
||
self.para.z1 = c_double(z1)
|
||
|
||
def setXYZ2(self, x2, y2, z2):
|
||
self.para.x2 = c_double(x2)
|
||
self.para.y2 = c_double(y2)
|
||
self.para.z2 = c_double(z2)
|
||
|
||
def setRadius1(self, radius1):
|
||
self.para.radius1 = c_double(radius1)
|
||
|
||
def setRadius2(self, radius2):
|
||
self.para.radius2 = c_double(radius2)
|
||
|
||
def setLength(self, length):
|
||
self.para.length = c_double(length)
|
||
|
||
def setPlanePara(self, planeType, normalLength):
|
||
self.para.planeType = c_int(planeType)
|
||
self.para.normalLength = c_double(normalLength)
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.para.isExists = c_bool(isExists)
|
||
|
||
def setIsFace(self, isFace):
|
||
self.para.isFace = c_bool(isFace)
|
||
|
||
def setVariableParaStr(self, variableParameter):
|
||
self.para.variableParaStr = bytes(variableParameter, encoding="utf-8")
|
||
|
||
|
||
# 二维直线类
|
||
class Line2d(BaseShape):
|
||
def __init__(self):
|
||
BaseShape.__init__(self)
|
||
|
||
def create(self):
|
||
command.CreateLine2d(self.para)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditLine2d(self.para)
|
||
del self
|
||
|
||
|
||
# 二维圆弧类
|
||
class CircularArc(BaseShape):
|
||
def __init__(self):
|
||
BaseShape.__init__(self)
|
||
self.x3 = c_double(0.0)
|
||
self.y3 = c_double(0.0)
|
||
self.z3 = c_double(0.0)
|
||
self.x4 = c_double(0.0)
|
||
self.y4 = c_double(0.0)
|
||
self.z4 = c_double(0.0)
|
||
|
||
def setXYZ3(self, x3, y3, z3):
|
||
self.x3 = x3
|
||
self.y3 = y3
|
||
self.z3 = z3
|
||
|
||
def setXYZ4(self, x4, y4, z4):
|
||
self.x4 = x4
|
||
self.y4 = y4
|
||
self.z4 = z4
|
||
|
||
def create(self):
|
||
command.CreateCircularArc(
|
||
self.para, c_double(self.x3), c_double(self.y3), c_double(self.z3)
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditCircularArc(
|
||
self.para, c_double(self.x3), c_double(self.y3), c_double(self.z3)
|
||
)
|
||
del self
|
||
|
||
|
||
# 二维矩形类
|
||
class Rectangle(BaseShape):
|
||
def __init__(self):
|
||
BaseShape.__init__(self)
|
||
|
||
def create(self):
|
||
command.CreateRectangle(self.para)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditRectangle(self.para)
|
||
del self
|
||
|
||
|
||
# 二维圆形类
|
||
class Circular(BaseShape):
|
||
def __init__(self):
|
||
BaseShape.__init__(self)
|
||
|
||
def create(self):
|
||
command.CreateCircular(self.para)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditCircular(self.para)
|
||
del self
|
||
|
||
|
||
# 二维正多边形类
|
||
class RegularPolygon(BaseShape):
|
||
def __init__(self):
|
||
BaseShape.__init__(self)
|
||
self.edgeCount = c_int(3)
|
||
|
||
def create(self):
|
||
command.CreateRegularPolygon(self.para, c_int(self.edgeCount))
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditRegularPolygon(self.para, c_int(self.edgeCount))
|
||
del self
|
||
|
||
def setEdgeCount(self, edgeCount):
|
||
self.edgeCount = edgeCount
|
||
|
||
|
||
# 二维多边形类
|
||
class Polygon(BaseShape):
|
||
def __init__(self):
|
||
BaseShape.__init__(self)
|
||
self.pntCnt = c_int(3)
|
||
self.points = ""
|
||
|
||
def setEdgeCount(self, pntCnt):
|
||
self.pntCnt = pntCnt
|
||
|
||
def setPoints(self, points):
|
||
self.points = points
|
||
|
||
def create(self):
|
||
pointsStr = bytes(self.points, encoding="utf-8")
|
||
command.CreatePolygon(self.para, pointsStr, c_int(self.pntCnt))
|
||
del self
|
||
|
||
|
||
def importGeometry(filename):
|
||
fileName = bytes(filename, encoding="utf-8")
|
||
command.importGeometry(fileName)
|
||
pass
|
||
|
||
|
||
def exportGeometry(filename):
|
||
fileName = bytes(filename, encoding="utf-8")
|
||
command.exportGeometry(fileName)
|
||
pass
|
||
|
||
|
||
def DeleteModel(idString):
|
||
idstr = bytes(idString, encoding="utf-8")
|
||
command.DeleteModel(
|
||
idstr,
|
||
)
|
||
pass
|
||
|
||
|
||
def DeleteModelsRelatedCoordinateSystem(idString):
|
||
idstr = bytes(idString, encoding="utf-8")
|
||
command.DeleteModelsRelatedCoordinateSystem(
|
||
idstr,
|
||
)
|
||
pass
|
||
|
||
|
||
class Almond:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.xMin = -5
|
||
self.xMax = 5
|
||
self.puxiMin = -180
|
||
self.puxiMax = 180
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setXRange(self, xMin, xMax):
|
||
self.xMin = xMin
|
||
self.xMax = xMax
|
||
|
||
def setPuxiRange(self, puxiMin, puxiMax):
|
||
self.puxiMin = puxiMin
|
||
self.puxiMax = puxiMax
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
command.CreateAlmond(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_double(self.xMin),
|
||
c_double(self.xMax),
|
||
c_double(self.puxiMin),
|
||
c_double(self.puxiMax),
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditAlmond(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_double(self.xMin),
|
||
c_double(self.xMax),
|
||
c_double(self.puxiMin),
|
||
c_double(self.puxiMax),
|
||
)
|
||
del self
|
||
|
||
|
||
class Box:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.planeType = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.l = 10
|
||
self.w = 10
|
||
self.h = 10
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setPlaneType(self, planeType):
|
||
self.planeType = planeType
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setPara(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateBox(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditBox(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class TruncationBoundary:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.index = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.l = 0
|
||
self.w = 0
|
||
self.h = 0
|
||
self.newdistancex = 0
|
||
self.newdistancey = 0
|
||
self.newdistancez = 0
|
||
self.ratiox = 1
|
||
self.ratioy = 1
|
||
self.ratioz = 1
|
||
self.distancex = 0
|
||
self.distancey = 0
|
||
self.distancez = 0
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setindex(self, index):
|
||
self.index = index
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setPara(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def setNewDistanceXYZ(self, newDistancex, newDistancey, newDistancez):
|
||
self.newdistancex = newDistancex
|
||
self.newdistancey = newDistancey
|
||
self.newdistancez = newDistancez
|
||
|
||
def setRatioXYZ(self, ratiox, ratioy, ratioz):
|
||
self.ratiox = ratiox
|
||
self.ratioy = ratioy
|
||
self.ratioz = ratioz
|
||
|
||
def setDistanceXYZ(self, distancex, distancey, distancez):
|
||
self.distancex = distancex
|
||
self.distancey = distancey
|
||
self.distancez = distancez
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateTruncationBoundary(
|
||
sname,
|
||
c_int(self.index),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.newdistancex),
|
||
c_double(self.newdistancey),
|
||
c_double(self.newdistancez),
|
||
c_double(self.ratiox),
|
||
c_double(self.ratioy),
|
||
c_double(self.ratioz),
|
||
c_double(self.distancex),
|
||
c_double(self.distancey),
|
||
c_double(self.distancez),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditTruncationBoundary(
|
||
c_int(self.editID),
|
||
c_int(self.index),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.newdistancex),
|
||
c_double(self.newdistancey),
|
||
c_double(self.newdistancez),
|
||
c_double(self.ratiox),
|
||
c_double(self.ratioy),
|
||
c_double(self.ratioz),
|
||
c_double(self.distancex),
|
||
c_double(self.distancey),
|
||
c_double(self.distancez),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Wedge:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.xBottom = 0
|
||
self.yBottom = 0
|
||
self.zBottom = 0
|
||
self.xTop = 0
|
||
self.yTop = 0
|
||
self.zTop = 0
|
||
self.dirX = 0
|
||
self.dirY = -1
|
||
self.dirZ = 0
|
||
self.bottomDx = 10
|
||
self.bottomDy = 10
|
||
self.topDx = 0
|
||
self.topDy = 0
|
||
self.height = 10
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setBottomLocation(self, xBottom, yBottom, zBottom):
|
||
self.XBottom = xBottom
|
||
self.YBottom = yBottom
|
||
self.ZBottom = zBottom
|
||
|
||
def setTopLocation(self, xTop, yTop, zTop):
|
||
self.XTop = xTop
|
||
self.YTop = yTop
|
||
self.ZTop = zTop
|
||
|
||
def setAxis(self, dirX, dirY, dirZ):
|
||
self.DirX = dirX
|
||
self.DirY = dirY
|
||
self.DirZ = dirZ
|
||
|
||
def setSize(self, bottomDx, bottomDy, topDx, topDy, height):
|
||
self.BottomDx = bottomDx
|
||
self.BottomDy = bottomDy
|
||
self.TopDx = topDx
|
||
self.TopDy = topDy
|
||
self.Height = height
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateWedge(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_double(self.XBottom),
|
||
c_double(self.YBottom),
|
||
c_double(self.ZBottom),
|
||
c_double(self.XTop),
|
||
c_double(self.YTop),
|
||
c_double(self.ZTop),
|
||
c_double(self.DirX),
|
||
c_double(self.DirY),
|
||
c_double(self.DirZ),
|
||
c_double(self.BottomDx),
|
||
c_double(self.BottomDy),
|
||
c_double(self.TopDx),
|
||
c_double(self.TopDy),
|
||
c_double(self.Height),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditWedge(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_double(self.XBottom),
|
||
c_double(self.YBottom),
|
||
c_double(self.ZBottom),
|
||
c_double(self.XTop),
|
||
c_double(self.YTop),
|
||
c_double(self.ZTop),
|
||
c_double(self.DirX),
|
||
c_double(self.DirY),
|
||
c_double(self.DirZ),
|
||
c_double(self.BottomDx),
|
||
c_double(self.BottomDy),
|
||
c_double(self.TopDx),
|
||
c_double(self.TopDy),
|
||
c_double(self.Height),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Antenna:
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setPara(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
command.CreateAntenna(
|
||
sname,
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditAntenna(
|
||
c_int(self.editID),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
)
|
||
del self
|
||
|
||
|
||
class Cylinder:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.planeType = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.l = 0
|
||
self.w = 0
|
||
self.h = 1
|
||
self.radius = 5
|
||
self.length = 10
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setPlaneType(self, planeType):
|
||
self.planeType = planeType
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setAxis(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def setRadius(self, radius):
|
||
self.radius = radius
|
||
|
||
def setLength(self, length):
|
||
self.length = length
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateCylinder(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.radius),
|
||
c_double(self.length),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditCylinder(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.radius),
|
||
c_double(self.length),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Cone:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.planeType = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.l = 0
|
||
self.w = 0
|
||
self.h = 1
|
||
self.radius = 5
|
||
self.radius2 = 0
|
||
self.length = 10
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setPlaneType(self, planeType):
|
||
self.planeType = planeType
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setAxis(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def setRadius(self, radius, radius2):
|
||
self.radius = radius
|
||
self.radius2 = radius2
|
||
|
||
def setLength(self, length):
|
||
self.length = length
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateCone(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.radius),
|
||
c_double(self.radius2),
|
||
c_double(self.length),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditCone(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.radius),
|
||
c_double(self.radius2),
|
||
c_double(self.length),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Sphere:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.radius = 5
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setRadius(self, radius):
|
||
self.radius = radius
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateSphere(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.radius),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditSphere(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.radius),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
# 三维球体拓展1
|
||
class SphereExpansion1(BaseShape):
|
||
def _init_(self):
|
||
BaseShape.__init__(self)
|
||
|
||
def create(self):
|
||
command.CreateSphereExpansion1(self.para)
|
||
del self
|
||
|
||
def edit(self):
|
||
command.EditSphereExpansion1(self.para)
|
||
del self
|
||
|
||
|
||
class Torus:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.planeType = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.l = 0
|
||
self.w = 0
|
||
self.h = 1
|
||
self.radius1 = 5
|
||
self.radius2 = 1
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setPlaneType(self, planeType):
|
||
self.planeType = planeType
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setAxis(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def setRadius(self, radius1, radius2):
|
||
self.radius1 = radius1
|
||
self.radius2 = radius2
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateTorus(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.radius1),
|
||
c_double(self.radius2),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditTorus(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_double(self.radius1),
|
||
c_double(self.radius2),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class RegularPrism:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.planeType = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.xe = 0
|
||
self.ye = 0
|
||
self.ze = 0
|
||
self.l = 0
|
||
self.w = 0
|
||
self.h = 1
|
||
self.edgeNum = 6
|
||
self.edgeLen = 5
|
||
self.Hei = 10
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setPlaneType(self, planeType):
|
||
self.planeType = planeType
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setEdgePnt(self, xe, ye, ze):
|
||
self.xe = xe
|
||
self.ye = ye
|
||
self.ze = ze
|
||
|
||
def setAxis(self, l, w, h):
|
||
self.l = l
|
||
self.w = w
|
||
self.h = h
|
||
|
||
def setedgeNumber(self, edgeNum):
|
||
self.edgeNum = edgeNum
|
||
|
||
def setedgeLength(self, edgeLen):
|
||
self.edgeLen = edgeLen
|
||
|
||
def setHeight(self, Hei):
|
||
self.Hei = Hei
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateRegularPrism(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.xe),
|
||
c_double(self.ye),
|
||
c_double(self.ze),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_int(self.edgeNum),
|
||
c_double(self.edgeLen),
|
||
c_double(self.Hei),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditRegularPrism(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_int(self.planeType),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.xe),
|
||
c_double(self.ye),
|
||
c_double(self.ze),
|
||
c_double(self.l),
|
||
c_double(self.w),
|
||
c_double(self.h),
|
||
c_int(self.edgeNum),
|
||
c_double(self.edgeLen),
|
||
c_double(self.Hei),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Helix:
|
||
def __init__(self):
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.Cylindrical = 1
|
||
self.pitch = 2
|
||
self.helixRadius = 5
|
||
self.cylinderNumber = 5
|
||
self.halfAngle = 30
|
||
self.GenerateSolid = 1
|
||
self.circleRadius = 0.5
|
||
self.method = 0
|
||
self.planemethod = '"XOY"'
|
||
self.reverse = 0
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setCylindrical(self, Cylindrical):
|
||
self.Cylindrical = Cylindrical
|
||
|
||
def setpitch(self, pitch):
|
||
self.pitch = pitch
|
||
|
||
def sethelixRadius(self, helixRadius):
|
||
self.helixRadius = helixRadius
|
||
|
||
def setcylinderNumber(self, cylinderNumber):
|
||
self.cylinderNumber = cylinderNumber
|
||
|
||
def sethalfAngle(self, halfAngle):
|
||
self.halfAngle = halfAngle
|
||
|
||
def setGenerateSolid(self, GenerateSolid):
|
||
self.GenerateSolid = GenerateSolid
|
||
|
||
def setcircleRadius(self, circleRadius):
|
||
self.circleRadius = circleRadius
|
||
|
||
def setSymmetricPlaneMethod(self, method):
|
||
self.method = method
|
||
|
||
def setPlaneMethod(self, planemethod):
|
||
self.planemethod = planemethod
|
||
|
||
def setreverse(self, reverse):
|
||
self.reverse = reverse
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateHelix(
|
||
sname,
|
||
c_int(self.coorSysID),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_bool(self.Cylindrical),
|
||
c_double(self.pitch),
|
||
c_double(self.helixRadius),
|
||
c_double(self.cylinderNumber),
|
||
c_double(self.halfAngle),
|
||
c_bool(self.GenerateSolid),
|
||
c_double(self.circleRadius),
|
||
methodstr,
|
||
planemestr,
|
||
c_bool(self.reverse),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditHelix(
|
||
c_int(self.editID),
|
||
c_int(self.coorSysID),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_bool(self.Cylindrical),
|
||
c_double(self.pitch),
|
||
c_double(self.helixRadius),
|
||
c_double(self.cylinderNumber),
|
||
c_double(self.halfAngle),
|
||
c_bool(self.GenerateSolid),
|
||
c_double(self.circleRadius),
|
||
methodstr,
|
||
planemestr,
|
||
c_bool(self.reverse),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Point:
|
||
def __init__(self):
|
||
self.x = 0
|
||
self.y = 0
|
||
self.z = 0
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.p1 = 0
|
||
self.p2 = 0
|
||
self.p3 = 0
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setLocation(self, x, y, z):
|
||
self.x = x
|
||
self.y = y
|
||
self.z = z
|
||
|
||
def setOffset(self, p1, p2, p3):
|
||
self.p1 = p1
|
||
self.p2 = p2
|
||
self.p3 = p3
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreatePoint(
|
||
sname,
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.p1),
|
||
c_double(self.p2),
|
||
c_double(self.p3),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditPoint(
|
||
c_int(self.editID),
|
||
c_double(self.x),
|
||
c_double(self.y),
|
||
c_double(self.z),
|
||
c_double(self.p1),
|
||
c_double(self.p2),
|
||
c_double(self.p3),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Line:
|
||
def __init__(self):
|
||
self.startpoint0 = 0
|
||
self.startpoint1 = 0
|
||
self.startpoint2 = 0
|
||
self.name = ""
|
||
self.editID = -1
|
||
self.method = 0
|
||
self.coor0 = 0
|
||
self.coor1 = 0
|
||
self.coor2 = 0
|
||
self.len = 10
|
||
self.reverse = 0
|
||
self.dir0 = 0
|
||
self.dir1 = 0
|
||
self.dir2 = 0
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setStartPoint(self, startpoint0, startpoint1, startpoint2):
|
||
self.startpoint0 = startpoint0
|
||
self.startpoint1 = startpoint1
|
||
self.startpoint2 = startpoint2
|
||
|
||
def setEndPoint(self, coor0, coor1, coor2):
|
||
self.method = 0
|
||
self.coor0 = coor0
|
||
self.coor1 = coor1
|
||
self.coor2 = coor2
|
||
|
||
def setDirection(self, dir0, dir1, dir2):
|
||
self.method = 1
|
||
self.dir0 = dir0
|
||
self.dir1 = dir1
|
||
self.dir2 = dir2
|
||
|
||
def setLength(self, len):
|
||
self.len = len
|
||
|
||
def setDirectionReverse(self, reverse):
|
||
self.reverse = reverse
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateLine(
|
||
sname,
|
||
c_double(self.startpoint0),
|
||
c_double(self.startpoint1),
|
||
c_double(self.startpoint2),
|
||
c_int(self.method),
|
||
c_double(self.coor0),
|
||
c_double(self.coor1),
|
||
c_double(self.coor2),
|
||
c_double(self.len),
|
||
c_double(self.dir0),
|
||
c_double(self.dir1),
|
||
c_double(self.dir2),
|
||
c_int(self.reverse),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditLine(
|
||
c_int(self.editID),
|
||
c_double(self.startpoint0),
|
||
c_double(self.startpoint1),
|
||
c_double(self.startpoint2),
|
||
c_int(self.method),
|
||
c_double(self.coor0),
|
||
c_double(self.coor1),
|
||
c_double(self.coor2),
|
||
c_double(self.len),
|
||
c_double(self.dir0),
|
||
c_double(self.dir1),
|
||
c_double(self.dir2),
|
||
c_int(self.reverse),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Face:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.name = ""
|
||
self.coorSysID = 0
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendEdge(self, geoset, index):
|
||
self.edges.setdefault(geoset, set()).add(index)
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.edges.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
sname = bytes(self.name, encoding="utf-8")
|
||
command.CreateFace(c_int(self.coorSysID), edgestr, sname, c_int(self.editID))
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class Chamfer:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.type = 0
|
||
self.d1 = 1.0
|
||
self.d2 = 1.0
|
||
self.typestr = "Symmetrical"
|
||
self.chamferType = 0
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setSectionType(self, typestr):
|
||
self.typestr = typestr
|
||
|
||
def setChamferType(self, chamferType):
|
||
self.chamferType = chamferType
|
||
|
||
def setSymmetricalDistance(self, d1):
|
||
self.d1 = d1
|
||
|
||
def setAsymmetricalDistances(self, d1, d2):
|
||
self.d1 = d1
|
||
self.d2 = d2
|
||
|
||
def appendEdge(self, geoset, index):
|
||
self.edges.setdefault(geoset, set()).add(index)
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.edges.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
if self.typestr == "Symmetrical":
|
||
self.type = 0
|
||
elif self.typestr == "Asymmetrical":
|
||
self.type = 1
|
||
command.CreateChamfer(
|
||
c_int(self.coorSysID),
|
||
edgestr,
|
||
c_int(self.editID),
|
||
c_double(self.d1),
|
||
c_double(self.d2),
|
||
c_int(self.type),
|
||
c_int(self.chamferType),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class Fillet:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.isExists = 0
|
||
self.filletType = 0
|
||
self.variablePara = ""
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendEdge(self, geoset, index):
|
||
self.edges.setdefault(geoset, set()).add(index)
|
||
|
||
def setFilletType(self, filletType):
|
||
self.filletType = filletType
|
||
|
||
def setRadius(self, r):
|
||
self.radius = r
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.edges.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateFillet(
|
||
c_int(self.coorSysID),
|
||
edgestr,
|
||
c_int(self.filletType),
|
||
c_double(self.radius),
|
||
c_int(self.editID),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class VariableFillet:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def VariableFilletOnEdge(self, setid, edgeindex):
|
||
self.setid = setid
|
||
self.edgeindex = edgeindex
|
||
|
||
def AppendVariablePoint(self, location, radius):
|
||
self.edges.setdefault(location, radius)
|
||
|
||
def setBasicRad(self, basicRad):
|
||
self.basicRad = basicRad
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
# values = self.edges.get(key)
|
||
# for v in values:
|
||
setstr = setstr + str(self.edges[key]) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
command.CreateVariableFillet(
|
||
c_int(self.coorSysID),
|
||
edgestr,
|
||
c_double(self.basicRad),
|
||
c_int(self.editID),
|
||
c_int(self.setid),
|
||
c_int(self.edgeindex),
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
class UnionOperation:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.selectModelType = 0
|
||
self.geometryModels = dict()
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setSelectModelType(self, modelType):
|
||
self.selectModelType = modelType
|
||
|
||
def appendGeometryModel(self, setid, modelIndex):
|
||
self.geometryModels.setdefault(setid, set()).add(modelIndex)
|
||
|
||
def create(self):
|
||
keyList1 = self.geometryModels.keys()
|
||
strcom1 = ""
|
||
for key in keyList1:
|
||
setstr1 = ""
|
||
values = self.geometryModels.get(key)
|
||
for v in values:
|
||
setstr1 = setstr1 + str(v) + ","
|
||
setstr1 = str(key) + ":" + setstr1[:-1]
|
||
strcom1 = strcom1 + setstr1 + ";"
|
||
strcom1 = strcom1[:-1]
|
||
bodystr1 = bytes(strcom1, encoding="utf-8")
|
||
command.CreateUnionOperation(
|
||
c_int(self.coorSysID),
|
||
c_int(self.selectModelType),
|
||
bodystr1,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList1 = self.geometryModels.keys()
|
||
strcom1 = ""
|
||
for key in keyList1:
|
||
setstr1 = ""
|
||
values = self.geometryModels.get(key)
|
||
for v in values:
|
||
setstr1 = setstr1 + str(v) + ","
|
||
setstr1 = str(key) + ":" + setstr1[:-1]
|
||
strcom1 = strcom1 + setstr1 + ";"
|
||
strcom1 = strcom1[:-1]
|
||
bodystr1 = bytes(strcom1, encoding="utf-8")
|
||
command.EditUnionOperation(
|
||
c_int(self.coorSysID),
|
||
c_int(self.selectModelType),
|
||
c_int(self.editID),
|
||
bodystr1,
|
||
)
|
||
del self
|
||
|
||
class BooLOperation:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.bodys1 = dict()
|
||
self.bodys2 = dict()
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setBoolType(self, booltype):
|
||
self.booltype = booltype
|
||
|
||
def set2d(self, bool2d):
|
||
self.bool2d = int(bool2d)
|
||
|
||
def appendBody1(self, setid, bodyindex):
|
||
self.bodys1.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def appendBody2(self, setid, bodyindex):
|
||
self.bodys2.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def SaveOrigin(self, saveBox2):
|
||
self.saveBox2 = saveBox2
|
||
|
||
def create(self):
|
||
keyList1 = self.bodys1.keys()
|
||
strcom1 = ""
|
||
for key in keyList1:
|
||
setstr1 = ""
|
||
values = self.bodys1.get(key)
|
||
for v in values:
|
||
setstr1 = setstr1 + str(v) + ","
|
||
setstr1 = str(key) + ":" + setstr1[:-1]
|
||
strcom1 = strcom1 + setstr1 + ";"
|
||
strcom1 = strcom1[:-1]
|
||
bodystr1 = bytes(strcom1, encoding="utf-8")
|
||
keyList2 = self.bodys2.keys()
|
||
strcom2 = ""
|
||
for key in keyList2:
|
||
setstr2 = ""
|
||
values = self.bodys2.get(key)
|
||
for v in values:
|
||
setstr2 = setstr2 + str(v) + ","
|
||
setstr2 = str(key) + ":" + setstr2[:-1]
|
||
strcom2 = strcom2 + setstr2 + ";"
|
||
strcom2 = strcom2[:-1]
|
||
bodystr2 = bytes(strcom2, encoding="utf-8")
|
||
typestr = bytes(self.booltype, encoding="utf-8")
|
||
savestr = bytes(self.saveBox2, encoding="utf-8")
|
||
command.CreateBooLOperation(
|
||
c_int(self.coorSysID),
|
||
typestr,
|
||
bodystr1,
|
||
bodystr2,
|
||
c_int(self.bool2d),
|
||
savestr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList1 = self.bodys1.keys()
|
||
strcom1 = ""
|
||
for key in keyList1:
|
||
setstr1 = ""
|
||
values = self.bodys1.get(key)
|
||
for v in values:
|
||
setstr1 = setstr1 + str(v) + ","
|
||
setstr1 = str(key) + ":" + setstr1[:-1]
|
||
strcom1 = strcom1 + setstr1 + ";"
|
||
strcom1 = strcom1[:-1]
|
||
bodystr1 = bytes(strcom1, encoding="utf-8")
|
||
keyList2 = self.bodys2.keys()
|
||
strcom2 = ""
|
||
for key in keyList2:
|
||
setstr2 = ""
|
||
values = self.bodys2.get(key)
|
||
for v in values:
|
||
setstr2 = setstr2 + str(v) + ","
|
||
setstr2 = str(key) + ":" + setstr2[:-1]
|
||
strcom2 = strcom2 + setstr2 + ";"
|
||
strcom2 = strcom2[:-1]
|
||
bodystr2 = bytes(strcom2, encoding="utf-8")
|
||
typestr = bytes(self.booltype, encoding="utf-8")
|
||
savestr = bytes(self.saveBox2, encoding="utf-8")
|
||
command.EditBooLOperation(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
typestr,
|
||
bodystr1,
|
||
bodystr2,
|
||
c_int(self.bool2d),
|
||
savestr,
|
||
)
|
||
del self
|
||
|
||
|
||
class BooLCutOperation:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.bodys1 = dict()
|
||
self.bodys2 = dict()
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def set2d(self, bool2d):
|
||
self.bool2d = int(bool2d)
|
||
|
||
def appendBody1(self, setid, bodyindex):
|
||
self.bodys1.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def appendBody2(self, setid, bodyindex):
|
||
self.bodys2.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def SaveOrigin(self, saveBox2):
|
||
self.saveBox2 = saveBox2
|
||
|
||
def create(self):
|
||
keyList1 = self.bodys1.keys()
|
||
strcom1 = ""
|
||
for key in keyList1:
|
||
setstr1 = ""
|
||
values = self.bodys1.get(key)
|
||
for v in values:
|
||
setstr1 = setstr1 + str(v) + ","
|
||
setstr1 = str(key) + ":" + setstr1[:-1]
|
||
strcom1 = strcom1 + setstr1 + ";"
|
||
strcom1 = strcom1[:-1]
|
||
bodystr1 = bytes(strcom1, encoding="utf-8")
|
||
keyList2 = self.bodys2.keys()
|
||
strcom2 = ""
|
||
for key in keyList2:
|
||
setstr2 = ""
|
||
values = self.bodys2.get(key)
|
||
for v in values:
|
||
setstr2 = setstr2 + str(v) + ","
|
||
setstr2 = str(key) + ":" + setstr2[:-1]
|
||
strcom2 = strcom2 + setstr2 + ";"
|
||
strcom2 = strcom2[:-1]
|
||
bodystr2 = bytes(strcom2, encoding="utf-8")
|
||
savestr = bytes(self.saveBox2, encoding="utf-8")
|
||
command.CreateBooLCutOperation(
|
||
c_int(self.coorSysID), bodystr1, bodystr2, c_int(self.bool2d), savestr
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList1 = self.bodys1.keys()
|
||
strcom1 = ""
|
||
for key in keyList1:
|
||
setstr1 = ""
|
||
values = self.bodys1.get(key)
|
||
for v in values:
|
||
setstr1 = setstr1 + str(v) + ","
|
||
setstr1 = str(key) + ":" + setstr1[:-1]
|
||
strcom1 = strcom1 + setstr1 + ";"
|
||
strcom1 = strcom1[:-1]
|
||
bodystr1 = bytes(strcom1, encoding="utf-8")
|
||
keyList2 = self.bodys2.keys()
|
||
strcom2 = ""
|
||
for key in keyList2:
|
||
setstr2 = ""
|
||
values = self.bodys2.get(key)
|
||
for v in values:
|
||
setstr2 = setstr2 + str(v) + ","
|
||
setstr2 = str(key) + ":" + setstr2[:-1]
|
||
strcom2 = strcom2 + setstr2 + ";"
|
||
strcom2 = strcom2[:-1]
|
||
bodystr2 = bytes(strcom2, encoding="utf-8")
|
||
savestr = bytes(self.saveBox2, encoding="utf-8")
|
||
command.EditBooLCutOperation(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
bodystr1,
|
||
bodystr2,
|
||
c_int(self.bool2d),
|
||
savestr,
|
||
)
|
||
del self
|
||
|
||
|
||
class MirrorFeature:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.faceindex = 0
|
||
self.facebody = 0
|
||
self.method = 0
|
||
self.planemethod = '"XOY"'
|
||
self.basepoint0 = 0
|
||
self.basepoint1 = 0
|
||
self.basepoint2 = 0
|
||
self.random0 = 0
|
||
self.random1 = 0
|
||
self.random2 = 0
|
||
self.save = 0
|
||
self.bodys = dict()
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def SaveOrigin(self, save):
|
||
self.save = save
|
||
|
||
def setSymmetricPlaneMethod(self, method):
|
||
self.method = method
|
||
|
||
def setFace(self, facebody, faceindex):
|
||
self.faceindex = faceindex
|
||
self.facebody = facebody
|
||
|
||
def setPlaneMethod(self, planemethod):
|
||
self.planemethod = planemethod
|
||
|
||
def setFeature(self, selectFeatures):
|
||
self.selectFeatures = selectFeatures
|
||
|
||
def setDir(self, random0, random1, random2):
|
||
self.random0 = random0
|
||
self.random1 = random1
|
||
self.random2 = random2
|
||
|
||
def setBasePt(self, basepoint0, basepoint1, basepoint2):
|
||
self.basepoint0 = basepoint0
|
||
self.basepoint1 = basepoint1
|
||
self.basepoint2 = basepoint2
|
||
|
||
def create(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
savestr = bytes(self.save, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
command.CreateMirrorFeature(
|
||
c_int(self.coorSysID),
|
||
bodystr,
|
||
methodstr,
|
||
c_int(self.faceindex),
|
||
c_int(self.facebody),
|
||
planemestr,
|
||
c_double(self.random0),
|
||
c_double(self.random1),
|
||
c_double(self.random2),
|
||
c_double(self.basepoint0),
|
||
c_double(self.basepoint1),
|
||
c_double(self.basepoint2),
|
||
savestr,
|
||
c_int(self.selectFeatures),
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
savestr = bytes(self.save, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
command.EditMirrorFeature(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
bodystr,
|
||
methodstr,
|
||
c_int(self.faceindex),
|
||
c_int(self.facebody),
|
||
planemestr,
|
||
c_double(self.random0),
|
||
c_double(self.random1),
|
||
c_double(self.random2),
|
||
c_double(self.basepoint0),
|
||
c_double(self.basepoint1),
|
||
c_double(self.basepoint2),
|
||
savestr,
|
||
c_int(self.selectFeatures),
|
||
)
|
||
del self
|
||
|
||
|
||
class MoveFeature:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.startpt0 = 0
|
||
self.startpt1 = 0
|
||
self.startpt2 = 0
|
||
self.endpt0 = 0
|
||
self.endpt1 = 0
|
||
self.endpt2 = 0
|
||
self.length = 10
|
||
self.dir0 = 0
|
||
self.dir1 = 0
|
||
self.dir2 = 0
|
||
self.reverse = "false"
|
||
self.bodys = dict()
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def TransformMethod(self, method):
|
||
self.method = method
|
||
|
||
def setStartPoint(self, startpt0, startpt1, startpt2):
|
||
self.startpt0 = startpt0
|
||
self.startpt1 = startpt1
|
||
self.startpt2 = startpt2
|
||
|
||
def setEndPoint(self, endpt0, endpt1, endpt2):
|
||
self.endpt0 = endpt0
|
||
self.endpt1 = endpt1
|
||
self.endpt2 = endpt2
|
||
|
||
def SaveOrigin(self, saveori):
|
||
self.saveori = saveori
|
||
|
||
def setReverse(self, reverse):
|
||
self.reverse = reverse
|
||
|
||
def setFeature(self, selectFeatures):
|
||
self.selectFeatures = selectFeatures
|
||
|
||
def setLength(self, length):
|
||
self.length = length
|
||
|
||
def setDirection(self, dir0, dir1, dir2):
|
||
self.dir0 = dir0
|
||
self.dir1 = dir1
|
||
self.dir2 = dir2
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methstr = bytes(self.method, encoding="utf-8")
|
||
saveoristr = bytes(self.saveori, encoding="utf-8")
|
||
reversestr = bytes(self.reverse, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateMoveFeature(
|
||
c_int(self.coorSysID),
|
||
bodystr,
|
||
methstr,
|
||
c_double(self.startpt0),
|
||
c_double(self.startpt1),
|
||
c_double(self.startpt2),
|
||
c_double(self.endpt0),
|
||
c_double(self.endpt1),
|
||
c_double(self.endpt2),
|
||
saveoristr,
|
||
reversestr,
|
||
c_double(self.length),
|
||
c_double(self.dir0),
|
||
c_double(self.dir1),
|
||
c_double(self.dir2),
|
||
c_int(self.selectFeatures),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methstr = bytes(self.method, encoding="utf-8")
|
||
saveoristr = bytes(self.saveori, encoding="utf-8")
|
||
reversestr = bytes(self.reverse, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditMoveFeature(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
bodystr,
|
||
methstr,
|
||
c_double(self.startpt0),
|
||
c_double(self.startpt1),
|
||
c_double(self.startpt2),
|
||
c_double(self.endpt0),
|
||
c_double(self.endpt1),
|
||
c_double(self.endpt2),
|
||
saveoristr,
|
||
reversestr,
|
||
c_double(self.length),
|
||
c_double(self.dir0),
|
||
c_double(self.dir1),
|
||
c_double(self.dir2),
|
||
c_int(self.selectFeatures),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class TransformCopy:
|
||
def __init__(self):
|
||
self.startpt0 = 0
|
||
self.startpt1 = 0
|
||
self.startpt2 = 0
|
||
self.endpt0 = 0
|
||
self.endpt1 = 0
|
||
self.endpt2 = 0
|
||
self.selectFeatures = 0
|
||
self.copyCnt = 0
|
||
self.bodys = dict()
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def setStartPoint(self, startpt0, startpt1, startpt2):
|
||
self.startpt0 = startpt0
|
||
self.startpt1 = startpt1
|
||
self.startpt2 = startpt2
|
||
|
||
def setEndPoint(self, endpt0, endpt1, endpt2):
|
||
self.endpt0 = endpt0
|
||
self.endpt1 = endpt1
|
||
self.endpt2 = endpt2
|
||
|
||
def setFeature(self, selectFeatures):
|
||
self.selectFeatures = selectFeatures
|
||
|
||
def setCopyCnt(self, copyCnt):
|
||
self.copyCnt = copyCnt
|
||
|
||
def create(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
command.CreateTransformCopy(
|
||
bodystr,
|
||
c_double(self.startpt0),
|
||
c_double(self.startpt1),
|
||
c_double(self.startpt2),
|
||
c_double(self.endpt0),
|
||
c_double(self.endpt1),
|
||
c_double(self.endpt2),
|
||
c_int(self.selectFeatures),
|
||
c_int(self.copyCnt),
|
||
)
|
||
del self
|
||
|
||
|
||
class ProjectionOnSurface:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.faceindex = 0
|
||
self.facebody = 0
|
||
self.method = 0
|
||
self.planemethod = '"XOY"'
|
||
self.projDir0 = 0
|
||
self.projDir1 = 0
|
||
self.projDir2 = 0
|
||
self.generateFace = 0
|
||
self.bodys = dict()
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def GenerateFace(self, generateFace):
|
||
self.generateFace = generateFace
|
||
|
||
def setProjPlaneMethod(self, method):
|
||
self.method = method
|
||
|
||
def setFace(self, facebody, faceindex):
|
||
self.faceindex = faceindex
|
||
self.facebody = facebody
|
||
|
||
def setPlaneMethod(self, planemethod):
|
||
self.planemethod = planemethod
|
||
|
||
def setFeature(self, selectFeatures):
|
||
self.selectFeatures = selectFeatures
|
||
|
||
def setProjextionDirection(self, projDir0, projDir1, projDir2):
|
||
self.projDir0 = projDir0
|
||
self.projDir1 = projDir1
|
||
self.projDir2 = projDir2
|
||
|
||
def create(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
generateFacestr = bytes(self.generateFace, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
command.CreateProjectionOnSurface(
|
||
c_int(self.coorSysID),
|
||
bodystr,
|
||
methodstr,
|
||
c_int(self.faceindex),
|
||
c_int(self.facebody),
|
||
planemestr,
|
||
c_double(self.projDir0),
|
||
c_double(self.projDir1),
|
||
c_double(self.projDir2),
|
||
generateFacestr,
|
||
c_int(self.selectFeatures),
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
generateFacestr = bytes(self.generateFace, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
command.EditProjectionOnSurface(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
bodystr,
|
||
methodstr,
|
||
c_int(self.faceindex),
|
||
c_int(self.facebody),
|
||
planemestr,
|
||
c_double(self.projDir0),
|
||
c_double(self.projDir1),
|
||
c_double(self.projDir2),
|
||
generateFacestr,
|
||
c_int(self.selectFeatures),
|
||
)
|
||
del self
|
||
|
||
|
||
class RotateFeature:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.saveOri = 0
|
||
self.rever = 0
|
||
self.body = 0
|
||
self.edge = 0
|
||
self.axisx = 0
|
||
self.axisy = 0
|
||
self.axisz = 0
|
||
self.axisMethod = 0
|
||
self.bodys = dict()
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def saveOrigin(self):
|
||
self.saveOri = 1
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def setBasicPoint(self, x, y, z):
|
||
self.basicx = x
|
||
self.basicy = y
|
||
self.basicz = z
|
||
|
||
def setAxisFromBody(self, body, edge):
|
||
self.axisMethod = 0
|
||
self.body = body
|
||
self.edge = edge
|
||
|
||
def setAxis(self, x, y, z):
|
||
self.axisMethod = 1
|
||
self.axisx = x
|
||
self.axisy = y
|
||
self.axisz = z
|
||
|
||
def reverse(self):
|
||
self.rever = 1
|
||
|
||
def setAngle(self, ang):
|
||
self.angle = ang
|
||
|
||
def setRotateFeature(self, selectRotateFeatures):
|
||
self.selectRotateFeatures = selectRotateFeatures
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def rotate(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
objstr = bytes(strcom, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.RotateFeature(
|
||
c_int(self.coorSysID),
|
||
objstr,
|
||
c_double(self.basicx),
|
||
c_double(self.basicy),
|
||
c_double(self.basicz),
|
||
c_int(self.axisMethod),
|
||
c_int(self.body),
|
||
c_int(self.edge),
|
||
c_double(self.axisx),
|
||
c_double(self.axisy),
|
||
c_double(self.axisz),
|
||
c_int(self.rever),
|
||
c_double(self.angle),
|
||
c_int(self.saveOri),
|
||
c_int(self.selectRotateFeatures),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
objstr = bytes(strcom, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditRotateFeature(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
objstr,
|
||
c_double(self.basicx),
|
||
c_double(self.basicy),
|
||
c_double(self.basicz),
|
||
c_int(self.axisMethod),
|
||
c_int(self.body),
|
||
c_int(self.edge),
|
||
c_double(self.axisx),
|
||
c_double(self.axisy),
|
||
c_double(self.axisz),
|
||
c_int(self.rever),
|
||
c_double(self.angle),
|
||
c_int(self.saveOri),
|
||
c_int(self.selectRotateFeatures),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class MakeMatrix:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.optionindex = 0
|
||
self.dir10 = 0
|
||
self.dir11 = 0
|
||
self.dir12 = 0
|
||
self.reverse1 = 0
|
||
self.dis1 = 15
|
||
self.count1 = 2
|
||
self.showdir2 = 0
|
||
self.dir20 = 0
|
||
self.dir21 = 0
|
||
self.dir22 = 0
|
||
self.reverse2 = 0
|
||
self.dis2 = 15
|
||
self.count2 = 2
|
||
self.basept0 = 0
|
||
self.basept1 = 0
|
||
self.basept2 = 0
|
||
self.axis0 = 0
|
||
self.axis1 = 0
|
||
self.axis2 = 0
|
||
self.wirereverse = 0
|
||
self.wirecount = 2
|
||
self.degree = 30
|
||
self.DistanceX = 0
|
||
self.DistanceY = 0
|
||
self.DistanceZ = 0
|
||
self.CountX = 1
|
||
self.CountY = 1
|
||
self.CountZ = 1
|
||
self.bodys = dict()
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def setOptionMethod(self, optionstr):
|
||
if optionstr == "Liear Matrix":
|
||
self.optionindex = 0
|
||
elif optionstr == "Wire Matrix":
|
||
self.optionindex = 1
|
||
elif optionstr == "Large Matrix":
|
||
self.optionindex = 2
|
||
|
||
def setDirection1(self, dir10, dir11, dir12):
|
||
self.dir10 = dir10
|
||
self.dir11 = dir11
|
||
self.dir12 = dir12
|
||
|
||
def setReverseOfDirection1(self, revstr):
|
||
if revstr == "Yes":
|
||
self.reverse1 = 1
|
||
elif revstr == "No":
|
||
self.reverse1 = 0
|
||
|
||
def setMatrix(self, selectFeatures):
|
||
self.selectFeatures = selectFeatures
|
||
|
||
def setDistance1(self, dis1):
|
||
self.dis1 = dis1
|
||
|
||
def setCount1(self, count1):
|
||
self.count1 = count1
|
||
|
||
def showDirection2(self, showdir2str):
|
||
if showdir2str == "Yes":
|
||
self.showdir2 = 1
|
||
elif showdir2str == "No":
|
||
self.showdir2 = 0
|
||
|
||
def setDirection2(self, dir20, dir21, dir22):
|
||
self.dir20 = dir20
|
||
self.dir21 = dir21
|
||
self.dir22 = dir22
|
||
|
||
def setReverseOfDirection2(self, revstr):
|
||
if revstr == "Yes":
|
||
self.reverse2 = 1
|
||
elif revstr == "No":
|
||
self.reverse2 = 0
|
||
|
||
def setDistance2(self, dis2):
|
||
self.dis2 = dis2
|
||
|
||
def setCount2(self, count2):
|
||
self.count2 = count2
|
||
|
||
def setBasicPoint(self, basepoint0, basepoint1, basepoint2):
|
||
self.basept0 = basepoint0
|
||
self.basept1 = basepoint1
|
||
self.basept2 = basepoint2
|
||
|
||
def setAxis(self, axis0, axis1, axis2):
|
||
self.axis0 = axis0
|
||
self.axis1 = axis1
|
||
self.axis2 = axis2
|
||
|
||
def setWireReverse(self, wirerestr):
|
||
if wirerestr == "Yes":
|
||
self.wirereverse = 1
|
||
elif wirerestr == "No":
|
||
self.wirereverse = 0
|
||
|
||
def setWireCount(self, wirecount):
|
||
self.wirecount = wirecount
|
||
|
||
def setDegree(self, degree):
|
||
self.degree = degree
|
||
|
||
def setXYZDistance(self, dx, dy, dz):
|
||
self.DistanceX = dx
|
||
self.DistanceY = dy
|
||
self.DistanceZ = dz
|
||
|
||
def setXYZCount(self, cx, cy, cz):
|
||
self.CountX = cx
|
||
self.CountY = cy
|
||
self.CountZ = cz
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.MakeMatrix(
|
||
c_int(self.coorSysID),
|
||
bodystr,
|
||
c_int(self.optionindex),
|
||
c_double(self.dir10),
|
||
c_double(self.dir11),
|
||
c_double(self.dir12),
|
||
c_int(self.reverse1),
|
||
c_double(self.dis1),
|
||
c_int(self.count1),
|
||
c_int(self.showdir2),
|
||
c_double(self.dir20),
|
||
c_double(self.dir21),
|
||
c_double(self.dir22),
|
||
c_int(self.reverse2),
|
||
c_double(self.dis2),
|
||
c_int(self.count2),
|
||
c_double(self.basept0),
|
||
c_double(self.basept1),
|
||
c_double(self.basept2),
|
||
c_double(self.axis0),
|
||
c_double(self.axis1),
|
||
c_double(self.axis2),
|
||
c_int(self.wirereverse),
|
||
c_int(self.wirecount),
|
||
c_double(self.degree),
|
||
c_double(self.DistanceX),
|
||
c_double(self.DistanceY),
|
||
c_double(self.DistanceZ),
|
||
c_int(self.CountX),
|
||
c_int(self.CountY),
|
||
c_int(self.CountZ),
|
||
c_int(self.selectFeatures),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.EditMatrix(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
bodystr,
|
||
c_int(self.optionindex),
|
||
c_double(self.dir10),
|
||
c_double(self.dir11),
|
||
c_double(self.dir12),
|
||
c_int(self.reverse1),
|
||
c_double(self.dis1),
|
||
c_int(self.count1),
|
||
c_int(self.showdir2),
|
||
c_double(self.dir20),
|
||
c_double(self.dir21),
|
||
c_double(self.dir22),
|
||
c_int(self.reverse2),
|
||
c_double(self.dis2),
|
||
c_int(self.count2),
|
||
c_double(self.basept0),
|
||
c_double(self.basept1),
|
||
c_double(self.basept2),
|
||
c_double(self.axis0),
|
||
c_double(self.axis1),
|
||
c_double(self.axis2),
|
||
c_int(self.wirereverse),
|
||
c_int(self.wirecount),
|
||
c_double(self.degree),
|
||
c_int(self.selectFeatures),
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
del self
|
||
|
||
|
||
class Extrusion:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.pt0 = 0
|
||
self.pt1 = 0
|
||
self.pt2 = 0
|
||
self.distance = 10
|
||
self.reverse = "No"
|
||
self.solid = "Yes"
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setDistance(self, distance):
|
||
self.distance = distance
|
||
|
||
def setDirection(self, pt0, pt1, pt2):
|
||
self.pt0 = pt0
|
||
self.pt1 = pt1
|
||
self.pt2 = pt2
|
||
|
||
def appendEdge(self, geoset, index):
|
||
self.edges.setdefault(geoset, set()).add(index)
|
||
|
||
def Reverse(self, reverse):
|
||
self.reverse = reverse
|
||
|
||
def GenerateSolid(self, solid):
|
||
self.solid = solid
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.edges.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
reversestr = bytes(self.reverse, encoding="utf-8")
|
||
solidstr = bytes(self.solid, encoding="utf-8")
|
||
namestr = bytes(self.name, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateExtrusion(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
namestr,
|
||
edgestr,
|
||
c_double(self.distance),
|
||
c_double(self.pt0),
|
||
c_double(self.pt1),
|
||
c_double(self.pt2),
|
||
reversestr,
|
||
solidstr,
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class Revol:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.basicpt0 = 0
|
||
self.basicpt1 = 0
|
||
self.basicpt2 = 0
|
||
self.coor0 = 0
|
||
self.coor1 = 0
|
||
self.coor2 = 0
|
||
self.degree = 90
|
||
self.reverse = "No"
|
||
self.solid = "Yes"
|
||
self.axisset = -1
|
||
self.edgeindex = -1
|
||
self.isExists = 0
|
||
self.variablePara = ""
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def setDegree(self, degree):
|
||
self.degree = degree
|
||
|
||
def setBasicPoint(self, basicpt0, basicpt1, basicpt2):
|
||
self.basicpt0 = basicpt0
|
||
self.basicpt1 = basicpt1
|
||
self.basicpt2 = basicpt2
|
||
|
||
def setAxisMethod(self, optionindex):
|
||
self.optionindex = optionindex
|
||
|
||
def setCoordinate(self, coor0, coor1, coor2):
|
||
self.coor0 = coor0
|
||
self.coor1 = coor1
|
||
self.coor2 = coor2
|
||
|
||
def selectAxisOnGeo(self, axisset, edgeindex):
|
||
self.axisset = axisset
|
||
self.edgeindex = edgeindex
|
||
|
||
def appendEdge(self, geoset, index):
|
||
self.edges.setdefault(geoset, set()).add(index)
|
||
|
||
def Reverse(self, reverse):
|
||
self.reverse = reverse
|
||
|
||
def GenerateSolid(self, solid):
|
||
self.solid = solid
|
||
|
||
def setIsExistsVariableParameter(self, isExists):
|
||
self.isExists = isExists
|
||
|
||
def setVariableHash(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.edges.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
reversestr = bytes(self.reverse, encoding="utf-8")
|
||
solidstr = bytes(self.solid, encoding="utf-8")
|
||
namestr = bytes(self.name, encoding="utf-8")
|
||
optionindexstr = bytes(self.optionindex, encoding="utf-8")
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
command.CreateRevol(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
namestr,
|
||
edgestr,
|
||
c_double(self.basicpt0),
|
||
c_double(self.basicpt1),
|
||
c_double(self.basicpt2),
|
||
c_double(self.degree),
|
||
optionindexstr,
|
||
c_int(self.axisset),
|
||
c_int(self.edgeindex),
|
||
c_double(self.coor0),
|
||
c_double(self.coor1),
|
||
c_double(self.coor2),
|
||
reversestr,
|
||
solidstr,
|
||
c_bool(self.isExists),
|
||
variableParaStr,
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class Loft:
|
||
def __init__(self):
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.solid = "No"
|
||
self.secstr = ""
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setName(self, name):
|
||
self.name = name
|
||
|
||
def isSolid(self, solid):
|
||
self.solid = solid
|
||
|
||
def appendSection(self, sec):
|
||
self.secstr += sec
|
||
self.secstr += " "
|
||
|
||
def create(self):
|
||
sectionstr = bytes(self.secstr, encoding="utf-8")
|
||
solidstr = bytes(self.solid, encoding="utf-8")
|
||
namestr = bytes(self.name, encoding="utf-8")
|
||
command.CreateLoft(
|
||
c_int(self.coorSysID), c_int(self.editID), namestr, solidstr, sectionstr
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class Sweep:
|
||
def __init__(self):
|
||
self.edges = dict()
|
||
self.editID = -1
|
||
self.coorSysID = 0
|
||
self.solid = "No"
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def appendEdge(self, geoset, index):
|
||
self.edges.setdefault(geoset, set()).add(index)
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setPath(self, pathset, pathedge):
|
||
self.pathset = pathset
|
||
self.pathedge = pathedge
|
||
|
||
def isSolid(self, solid):
|
||
self.solid = solid
|
||
|
||
def create(self):
|
||
keyList = self.edges.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.edges.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
edgestr = bytes(strcom, encoding="utf-8")
|
||
solidstr = bytes(self.solid, encoding="utf-8")
|
||
command.CreateSweep(
|
||
c_int(self.coorSysID),
|
||
c_int(self.editID),
|
||
edgestr,
|
||
solidstr,
|
||
c_int(self.pathset),
|
||
c_int(self.pathedge),
|
||
)
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class GeoSplitter:
|
||
def __init__(self):
|
||
self.coorSysID = 0
|
||
self.modelTypeIndex = -1
|
||
self.faceindex = -1
|
||
self.facebody = -1
|
||
self.editID = -1
|
||
self.method = 0
|
||
self.planemethod = '"XOY"'
|
||
self.basepoint0 = 0
|
||
self.basepoint1 = 0
|
||
self.basepoint2 = 0
|
||
self.random0 = 0
|
||
self.random1 = 0
|
||
self.random2 = 0
|
||
self.bodys = dict()
|
||
|
||
def setCoorSysID(self, csid):
|
||
self.coorSysID = csid
|
||
|
||
def setSplitterModelType(self, modelTypeIndex):
|
||
self.modelType = modelTypeIndex
|
||
|
||
def appendBody(self, setid, bodyindex):
|
||
self.bodys.setdefault(setid, set()).add(bodyindex)
|
||
|
||
def setSymmetricPlaneMethod(self, method):
|
||
self.method = method
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setFace(self, facebody, faceindex):
|
||
self.facebody = facebody
|
||
self.faceindex = faceindex
|
||
|
||
def setPlaneMethod(self, planemethod):
|
||
self.planemethod = planemethod
|
||
|
||
def setDir(self, random0, random1, random2):
|
||
self.random0 = random0
|
||
self.random1 = random1
|
||
self.random2 = random2
|
||
|
||
def setBasePt(self, basepoint0, basepoint1, basepoint2):
|
||
self.basepoint0 = basepoint0
|
||
self.basepoint1 = basepoint1
|
||
self.basepoint2 = basepoint2
|
||
|
||
def create(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
command.MakeGeoSplitter(
|
||
c_int(self.coorSysID),
|
||
c_int(self.modelType),
|
||
bodystr,
|
||
methodstr,
|
||
c_int(self.faceindex),
|
||
c_int(self.facebody),
|
||
planemestr,
|
||
c_double(self.random0),
|
||
c_double(self.random1),
|
||
c_double(self.random2),
|
||
c_double(self.basepoint0),
|
||
c_double(self.basepoint1),
|
||
c_double(self.basepoint2),
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
keyList = self.bodys.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.bodys.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
bodystr = bytes(strcom, encoding="utf-8")
|
||
methodstr = bytes(self.method, encoding="utf-8")
|
||
planemestr = bytes(self.planemethod, encoding="utf-8")
|
||
command.EditGeoSplitter(
|
||
c_int(self.coorSysID),
|
||
c_int(self.modelType),
|
||
c_int(self.editID),
|
||
bodystr,
|
||
methodstr,
|
||
c_int(self.faceindex),
|
||
c_int(self.facebody),
|
||
planemestr,
|
||
c_double(self.random0),
|
||
c_double(self.random1),
|
||
c_double(self.random2),
|
||
c_double(self.basepoint0),
|
||
c_double(self.basepoint1),
|
||
c_double(self.basepoint2),
|
||
)
|
||
del self
|
||
|
||
|
||
class FillHole:
|
||
def __init__(self):
|
||
self.faces = dict()
|
||
self.editID = -1
|
||
|
||
def appendFace(self, geoset, index):
|
||
self.faces.setdefault(geoset, set()).add(index)
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def create(self):
|
||
keyList = self.faces.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.faces.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
facestr = bytes(strcom, encoding="utf-8")
|
||
command.MakeFillHole(facestr, c_int(self.editID))
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class RemoveSurface:
|
||
def __init__(self):
|
||
self.faces = dict()
|
||
self.editID = -1
|
||
|
||
def appendFace(self, geoset, index):
|
||
self.faces.setdefault(geoset, set()).add(index)
|
||
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def create(self):
|
||
keyList = self.faces.keys()
|
||
strcom = ""
|
||
for key in keyList:
|
||
setstr = ""
|
||
values = self.faces.get(key)
|
||
for v in values:
|
||
setstr = setstr + str(v) + ","
|
||
setstr = str(key) + ":" + setstr[:-1]
|
||
strcom = strcom + setstr + ";"
|
||
strcom = strcom[:-1]
|
||
facestr = bytes(strcom, encoding="utf-8")
|
||
command.MakeRemoveSurface(facestr, c_int(self.editID))
|
||
|
||
def edit(self):
|
||
self.create()
|
||
|
||
|
||
class FillGap:
|
||
def setEditID(self, id):
|
||
self.editID = id
|
||
|
||
def setFillGapType(self, type):
|
||
self.fillgaptype = type
|
||
|
||
def setIndexOfShape1(self, set1, body1Index):
|
||
self.set1 = set1
|
||
self.body1Index = body1Index
|
||
|
||
def setIndexOfShape2(self, set2, body2Index):
|
||
self.set2 = set2
|
||
self.body2Index = body2Index
|
||
|
||
def create(self):
|
||
typestr = bytes(self.fillgaptype, encoding="utf-8")
|
||
command.CreateFillGap(
|
||
typestr,
|
||
c_int(self.set1),
|
||
c_int(self.body1Index),
|
||
c_int(self.set2),
|
||
c_int(self.body2Index),
|
||
)
|
||
del self
|
||
|
||
def edit(self):
|
||
typestr = bytes(self.fillgaptype, encoding="utf-8")
|
||
command.EditFillGap(
|
||
c_int(self.editID),
|
||
typestr,
|
||
c_int(self.set1),
|
||
c_int(self.body1Index),
|
||
c_int(self.set2),
|
||
c_int(self.body2Index),
|
||
)
|
||
del self
|
||
|
||
|
||
class ModifyVariableParameter:
|
||
def __init__(self):
|
||
self.value = 0
|
||
self.variablePara = ""
|
||
|
||
def setVariableName(self, variableParameter):
|
||
self.variablePara = variableParameter
|
||
|
||
def setVariableValue(self, val):
|
||
self.value = val
|
||
|
||
def create(self):
|
||
variableParaStr = bytes(self.variablePara, encoding="utf-8")
|
||
variablevalueStr = bytes(self.value, encoding="utf-8")
|
||
command.MVP_setVariablePara(variableParaStr, variablevalueStr)
|
||
del self
|