コード例 #1
0
	def __init__(self, elementNode):
		'Initialize.'
		elementNode.attributes['closed'] = 'true'
		self.density = evaluate.getEvaluatedFloat(1.0, elementNode, 'density')
		self.minimumRadiusOverThickness = evaluate.getEvaluatedFloat(1.0, elementNode, 'minimumRadiusOverThickness')
		self.mobile = evaluate.getEvaluatedBoolean(False, elementNode, 'mobile')
		self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
		self.path = None
		if 'path' in elementNode.attributes:
			self.path = evaluate.getPathByKey([], elementNode, 'path')
		self.searchAttempts = evaluate.getEvaluatedInt(0, elementNode, 'searchAttempts')
		self.searchRadiusOverRadius = evaluate.getEvaluatedFloat(1.0, elementNode, 'searchRadiusOverRadius')
		self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
		self.wallThickness = evaluate.getEvaluatedFloat(2.0 * setting.getPerimeterWidth(elementNode), elementNode, 'wallThickness')
		# Set derived variables.
		self.halfWallThickness = 0.5 * self.wallThickness
		self.inradiusMinusThickness = self.inradius - complex(self.wallThickness, self.wallThickness)
		self.minimumRadius = evaluate.getEvaluatedFloat(self.minimumRadiusOverThickness * self.wallThickness, elementNode, 'minimumRadius')
		self.inradiusMinusRadiusThickness = self.inradiusMinusThickness - complex(self.minimumRadius, self.minimumRadius)
		self.potentialBubbleArea = 4.0 * self.inradiusMinusThickness.real * self.inradiusMinusThickness.imag
		if self.path is None:
			radiusPlusHalfThickness = self.minimumRadius + self.halfWallThickness
			numberOfPoints = int(math.ceil(self.density * self.potentialBubbleArea / math.pi / radiusPlusHalfThickness / radiusPlusHalfThickness))
			self.path = []
			if self.seed is None:
				self.seed = time.time()
				print('Sponge slice seed used was: %s' % self.seed)
			random.seed(self.seed)
			for pointIndex in xrange(numberOfPoints):
				point = euclidean.getRandomComplex(-self.inradiusMinusRadiusThickness, self.inradiusMinusRadiusThickness)
				self.path.append(Vector3(point.real, point.imag))
コード例 #2
0
ファイル: mechaslab.py プロジェクト: hy19910/Cura
 def __init__(self, elementNode):
     "Set defaults."
     self.bevelOverRadius = evaluate.getEvaluatedFloat(0.2, elementNode, "bevelOverRadius")
     self.boltRadiusOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, "boltRadiusOverRadius")
     self.columns = evaluate.getEvaluatedInt(2, elementNode, "columns")
     self.elementNode = elementNode
     self.heightOverRadius = evaluate.getEvaluatedFloat(2.0, elementNode, "heightOverRadius")
     self.interiorOverhangRadians = setting.getInteriorOverhangRadians(elementNode)
     self.overhangSpan = setting.getOverhangSpan(elementNode)
     self.pegClearanceOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, "pegClearanceOverRadius")
     self.pegRadians = math.radians(evaluate.getEvaluatedFloat(2.0, elementNode, "pegAngle"))
     self.pegHeightOverHeight = evaluate.getEvaluatedFloat(0.4, elementNode, "pegHeightOverHeight")
     self.pegRadiusOverRadius = evaluate.getEvaluatedFloat(0.7, elementNode, "pegRadiusOverRadius")
     self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, "radius", "width", 5.0)
     self.rows = evaluate.getEvaluatedInt(1, elementNode, "rows")
     self.topBevelOverRadius = evaluate.getEvaluatedFloat(0.2, elementNode, "topBevelOverRadius")
     # Set derived values.
     self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radius, elementNode, "bevel")
     self.boltRadius = evaluate.getEvaluatedFloat(self.boltRadiusOverRadius * self.radius, elementNode, "boltRadius")
     self.boltSides = evaluate.getSidesMinimumThreeBasedOnPrecision(elementNode, self.boltRadius)
     self.bottomLeftCenter = complex(-float(self.columns - 1), -float(self.rows - 1)) * self.radius
     self.height = evaluate.getEvaluatedFloat(self.heightOverRadius * self.radius, elementNode, "height")
     self.hollowPegSockets = []
     centerY = self.bottomLeftCenter.imag
     diameter = self.radius + self.radius
     self.pegExistence = CellExistence(
         self.columns, self.rows, evaluate.getEvaluatedValue(None, elementNode, "pegs")
     )
     self.socketExistence = CellExistence(
         self.columns, self.rows, evaluate.getEvaluatedValue(None, elementNode, "sockets")
     )
     for rowIndex in xrange(self.rows):
         centerX = self.bottomLeftCenter.real
         for columnIndex in xrange(self.columns):
             hollowPegSocket = HollowPegSocket(complex(centerX, centerY))
             hollowPegSocket.shouldAddPeg = self.pegExistence.getIsInExistence(columnIndex, rowIndex)
             hollowPegSocket.shouldAddSocket = self.socketExistence.getIsInExistence(columnIndex, rowIndex)
             self.hollowPegSockets.append(hollowPegSocket)
             centerX += diameter
         centerY += diameter
     self.pegClearance = evaluate.getEvaluatedFloat(
         self.pegClearanceOverRadius * self.radius, elementNode, "pegClearance"
     )
     halfPegClearance = 0.5 * self.pegClearance
     self.pegHeight = evaluate.getEvaluatedFloat(self.pegHeightOverHeight * self.height, elementNode, "pegHeight")
     self.pegRadius = evaluate.getEvaluatedFloat(self.pegRadiusOverRadius * self.radius, elementNode, "pegRadius")
     sides = 24 * max(1, math.floor(evaluate.getSidesBasedOnPrecision(elementNode, self.pegRadius) / 24))
     self.socketRadius = self.pegRadius + halfPegClearance
     self.pegSides = evaluate.getEvaluatedInt(sides, elementNode, "pegSides")
     self.pegRadius -= halfPegClearance
     self.pegRadiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.pegRadius, self.pegSides
     )
     self.socketSides = evaluate.getEvaluatedInt(sides, elementNode, "socketSides")
     self.socketRadiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.socketRadius, self.socketSides
     )
     self.topBevel = evaluate.getEvaluatedFloat(self.topBevelOverRadius * self.radius, elementNode, "topBevel")
     self.topBevelPositions = evaluate.getEvaluatedString("nwse", elementNode, "topBevelPositions").lower()
     self.topRight = complex(float(self.columns), float(self.rows)) * self.radius
コード例 #3
0
ファイル: segment.py プロジェクト: koenkooi/ReplicatorG
 def __init__(self, modulo, prefix, xmlElement):
     "Initialize."
     self.start = evaluate.getEvaluatedInt(0, prefix + "start", xmlElement)
     self.extent = evaluate.getEvaluatedInt(modulo - self.start, prefix + "extent", xmlElement)
     self.end = evaluate.getEvaluatedInt(self.start + self.extent, prefix + "end", xmlElement)
     self.revolutions = evaluate.getEvaluatedInt(1, prefix + "revolutions", xmlElement)
     if self.revolutions > 1:
         self.end += modulo * (self.revolutions - 1)
コード例 #4
0
ファイル: segment.py プロジェクト: Sciumo/SFACT
	def __init__(self, modulo, prefix, xmlElement):
		"""Initialize."""
		self.start = evaluate.getEvaluatedInt(0, prefix + 'start', xmlElement)
		self.extent = evaluate.getEvaluatedInt(modulo - self.start, prefix + 'extent', xmlElement)
		self.end = evaluate.getEvaluatedInt(self.start + self.extent, prefix + 'end', xmlElement)
		self.revolutions = evaluate.getEvaluatedInt(1, prefix + 'revolutions', xmlElement)
		if self.revolutions > 1:
			self.end += modulo * (self.revolutions - 1)
コード例 #5
0
ファイル: segment.py プロジェクト: maestroflema/asimov
	def __init__(self, elementNode, modulo, prefix):
		"Initialize."
		self.start = evaluate.getEvaluatedInt(0, elementNode, prefix + 'start')
		self.extent = evaluate.getEvaluatedInt(modulo - self.start, elementNode, prefix + 'extent')
		self.end = evaluate.getEvaluatedInt(self.start + self.extent, elementNode, prefix + 'end')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, prefix + 'revolutions')
		if self.revolutions > 1:
			self.end += modulo * (self.revolutions - 1)
コード例 #6
0
ファイル: segment.py プロジェクト: folksjos/RepG
	def __init__(self, elementNode, modulo, prefix):
		"Initialize."
		self.start = evaluate.getEvaluatedInt(0, elementNode, prefix + 'start')
		self.extent = evaluate.getEvaluatedInt(modulo - self.start, elementNode, prefix + 'extent')
		self.end = evaluate.getEvaluatedInt(self.start + self.extent, elementNode, prefix + 'end')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, prefix + 'revolutions')
		if self.revolutions > 1:
			self.end += modulo * (self.revolutions - 1)
コード例 #7
0
ファイル: segment.py プロジェクト: CNCBASHER/skeinforge-1
 def __init__(self, modulo, prefix, xmlElement):
     "Initialize."
     self.start = evaluate.getEvaluatedInt(0, prefix + 'start', xmlElement)
     self.extent = evaluate.getEvaluatedInt(modulo - self.start,
                                            prefix + 'extent', xmlElement)
     self.end = evaluate.getEvaluatedInt(self.start + self.extent,
                                         prefix + 'end', xmlElement)
     self.revolutions = evaluate.getEvaluatedInt(1, prefix + 'revolutions',
                                                 xmlElement)
     if self.revolutions > 1:
         self.end += modulo * (self.revolutions - 1)
コード例 #8
0
ファイル: polygon.py プロジェクト: folksjos/RepG
	def __init__(self, elementNode):
		'Set defaults.'
		self.sides = evaluate.getEvaluatedFloat(4.0, elementNode, 'sides')
		self.sideAngle = 2.0 * math.pi / self.sides
		cosSide = math.cos(0.5 * self.sideAngle)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, cosSide, ['apothem', 'inradius'], complex(1.0, 1.0))
		self.radius = lineation.getComplexByPrefixes(elementNode, ['demisize', 'radius'], self.radius)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, 2.0, ['diameter', 'size'], self.radius)
		self.sidesCeiling = int(math.ceil(abs(self.sides)))
		self.start = evaluate.getEvaluatedInt(0, elementNode, 'start')
		end = evaluate.getEvaluatedInt(self.sidesCeiling, elementNode, 'end')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.extent = evaluate.getEvaluatedInt(end - self.start, elementNode, 'extent')
		self.extent += self.sidesCeiling * (self.revolutions - 1)
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
コード例 #9
0
ファイル: polygon.py プロジェクト: maestroflema/asimov
	def __init__(self, elementNode):
		'Set defaults.'
		self.sides = evaluate.getEvaluatedFloat(4.0, elementNode, 'sides')
		self.sideAngle = 2.0 * math.pi / self.sides
		cosSide = math.cos(0.5 * self.sideAngle)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, cosSide, ['apothem', 'inradius'], complex(1.0, 1.0))
		self.radius = lineation.getComplexByPrefixes(elementNode, ['demisize', 'radius'], self.radius)
		self.radius = lineation.getComplexByMultiplierPrefixes(elementNode, 2.0, ['diameter', 'size'], self.radius)
		self.sidesCeiling = int(math.ceil(abs(self.sides)))
		self.start = evaluate.getEvaluatedInt(0, elementNode, 'start')
		end = evaluate.getEvaluatedInt(self.sidesCeiling, elementNode, 'end')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.extent = evaluate.getEvaluatedInt(end - self.start, elementNode, 'extent')
		self.extent += self.sidesCeiling * (self.revolutions - 1)
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
コード例 #10
0
ファイル: mechaslab.py プロジェクト: Sciumo/SFACT
	def __init__(self, xmlElement):
		"""Set defaults."""
		self.bevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'bevelOverRadius', xmlElement)
		self.boltRadiusOverRadius = evaluate.getEvaluatedFloat(0.0, 'boltRadiusOverRadius', xmlElement)
		self.columns = evaluate.getEvaluatedInt(2, 'columns', xmlElement)
		self.heightOverRadius = evaluate.getEvaluatedFloat(2.0, 'heightOverRadius', xmlElement)
		self.interiorOverhangRadians = setting.getInteriorOverhangRadians(xmlElement)
		self.overhangSpan = setting.getOverhangSpan(xmlElement)
		self.pegClearanceOverRadius = evaluate.getEvaluatedFloat(0.0, 'pegClearanceOverRadius', xmlElement)
		self.pegRadians = math.radians(evaluate.getEvaluatedFloat(2.0, 'pegAngle', xmlElement))
		self.pegHeightOverHeight = evaluate.getEvaluatedFloat(0.4, 'pegHeightOverHeight', xmlElement)
		self.pegRadiusOverRadius = evaluate.getEvaluatedFloat(0.7, 'pegRadiusOverRadius', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'width', 5.0, xmlElement)
		self.rows = evaluate.getEvaluatedInt(1, 'rows', xmlElement)
		self.topBevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'topBevelOverRadius', xmlElement)
		self.xmlElement = xmlElement
		# Set derived values.
		self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radius, 'bevel', xmlElement)
		self.boltRadius = evaluate.getEvaluatedFloat(self.boltRadiusOverRadius * self.radius, 'boltRadius', xmlElement)
		self.boltSides = evaluate.getSidesMinimumThreeBasedOnPrecision(self.boltRadius, xmlElement)
		self.bottomLeftCenter = complex(-float(self.columns - 1), -float(self.rows - 1)) * self.radius
		self.height = evaluate.getEvaluatedFloat(self.heightOverRadius * self.radius, 'height', xmlElement)
		self.hollowPegSockets = []
		centerY = self.bottomLeftCenter.imag
		diameter = self.radius + self.radius
		self.pegExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'pegs', xmlElement))
		self.socketExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'sockets', xmlElement))
		for rowIndex in xrange(self.rows):
			centerX = self.bottomLeftCenter.real
			for columnIndex in xrange(self.columns):
				hollowPegSocket = HollowPegSocket(complex(centerX, centerY))
				hollowPegSocket.shouldAddPeg = self.pegExistence.getIsInExistence(columnIndex, rowIndex)
				hollowPegSocket.shouldAddSocket = self.socketExistence.getIsInExistence(columnIndex, rowIndex)
				self.hollowPegSockets.append(hollowPegSocket)
				centerX += diameter
			centerY += diameter
		self.pegClearance = evaluate.getEvaluatedFloat(self.pegClearanceOverRadius * self.radius, 'pegClearance', xmlElement)
		halfPegClearance = 0.5 * self.pegClearance
		self.pegHeight = evaluate.getEvaluatedFloat(self.pegHeightOverHeight * self.height, 'pegHeight', xmlElement)
		self.pegRadius = evaluate.getEvaluatedFloat(self.pegRadiusOverRadius * self.radius, 'pegRadius', xmlElement)
		sides = 24 * max(1, math.floor(evaluate.getSidesBasedOnPrecision(self.pegRadius, xmlElement) / 24))
		self.socketRadius = self.pegRadius + halfPegClearance
		self.pegSides = evaluate.getEvaluatedInt(sides, 'pegSides', xmlElement)
		self.socketSides = evaluate.getEvaluatedInt(sides, 'socketSides', xmlElement)
		self.pegRadius -= halfPegClearance
		self.topBevel = evaluate.getEvaluatedFloat(self.topBevelOverRadius * self.radius, 'topBevel', xmlElement)
		self.topBevelPositions = evaluate.getEvaluatedString('nwse', 'topBevelPositions', xmlElement).lower()
		self.topRight = complex(float(self.columns), float(self.rows)) * self.radius
コード例 #11
0
ファイル: mechaslab.py プロジェクト: CNCBASHER/skeinforge-1
	def __init__(self, xmlElement):
		'Set defaults.'
		self.bevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'bevelOverRadius', xmlElement)
		self.boltRadiusOverRadius = evaluate.getEvaluatedFloat(0.0, 'boltRadiusOverRadius', xmlElement)
		self.columns = evaluate.getEvaluatedInt(2, 'columns', xmlElement)
		self.heightOverRadius = evaluate.getEvaluatedFloat(2.0, 'heightOverRadius', xmlElement)
		self.interiorOverhangRadians = setting.getInteriorOverhangRadians(xmlElement)
		self.overhangSpan = setting.getOverhangSpan(xmlElement)
		self.pegClearanceOverRadius = evaluate.getEvaluatedFloat(0.0, 'pegClearanceOverRadius', xmlElement)
		self.pegRadians = math.radians(evaluate.getEvaluatedFloat(2.0, 'pegAngle', xmlElement))
		self.pegHeightOverHeight = evaluate.getEvaluatedFloat(0.4, 'pegHeightOverHeight', xmlElement)
		self.pegRadiusOverRadius = evaluate.getEvaluatedFloat(0.7, 'pegRadiusOverRadius', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'width', 5.0, xmlElement)
		self.rows = evaluate.getEvaluatedInt(1, 'rows', xmlElement)
		self.topBevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'topBevelOverRadius', xmlElement)
		self.xmlElement = xmlElement
		# Set derived values.
		self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radius, 'bevel', xmlElement)
		self.boltRadius = evaluate.getEvaluatedFloat(self.boltRadiusOverRadius * self.radius, 'boltRadius', xmlElement)
		self.boltSides = evaluate.getSidesMinimumThreeBasedOnPrecision(self.boltRadius, xmlElement)
		self.bottomLeftCenter = complex(-float(self.columns - 1), -float(self.rows - 1)) * self.radius
		self.height = evaluate.getEvaluatedFloat(self.heightOverRadius * self.radius, 'height', xmlElement)
		self.hollowPegSockets = []
		centerY = self.bottomLeftCenter.imag
		diameter = self.radius + self.radius
		self.pegExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'pegs', xmlElement))
		self.socketExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'sockets', xmlElement))
		for rowIndex in xrange(self.rows):
			centerX = self.bottomLeftCenter.real
			for columnIndex in xrange(self.columns):
				hollowPegSocket = HollowPegSocket(complex(centerX, centerY))
				hollowPegSocket.shouldAddPeg = self.pegExistence.getIsInExistence(columnIndex, rowIndex)
				hollowPegSocket.shouldAddSocket = self.socketExistence.getIsInExistence(columnIndex, rowIndex)
				self.hollowPegSockets.append(hollowPegSocket)
				centerX += diameter
			centerY += diameter
		self.pegClearance = evaluate.getEvaluatedFloat(self.pegClearanceOverRadius * self.radius, 'pegClearance', xmlElement)
		halfPegClearance = 0.5 * self.pegClearance
		self.pegHeight = evaluate.getEvaluatedFloat(self.pegHeightOverHeight * self.height, 'pegHeight', xmlElement)
		self.pegRadius = evaluate.getEvaluatedFloat(self.pegRadiusOverRadius * self.radius, 'pegRadius', xmlElement)
		sides = 24 * max(1, math.floor(evaluate.getSidesBasedOnPrecision(self.pegRadius, xmlElement) / 24))
		self.socketRadius = self.pegRadius + halfPegClearance
		self.pegSides = evaluate.getEvaluatedInt(sides, 'pegSides', xmlElement)
		self.socketSides = evaluate.getEvaluatedInt(sides, 'socketSides', xmlElement)
		self.pegRadius -= halfPegClearance
		self.topBevel = evaluate.getEvaluatedFloat(self.topBevelOverRadius * self.radius, 'topBevel', xmlElement)
		self.topBevelPositions = evaluate.getEvaluatedString('nwse', 'topBevelPositions', xmlElement).lower()
		self.topRight = complex(float(self.columns), float(self.rows)) * self.radius
コード例 #12
0
ファイル: face.py プロジェクト: clothbot/DotSkeinforge
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	face = Face()
	face.index = len( xmlElement.parent.object.faces )
	for vertexIndexIndex in xrange( 3 ):
		face.vertexIndexes.append( evaluate.getEvaluatedInt('vertex' + str( vertexIndexIndex ), xmlElement ) )
	xmlElement.parent.object.faces.append( face )
コード例 #13
0
ファイル: grid.py プロジェクト: GottfriedSp/ReplicatorG
def getRandomGrid(derivation, diameter, elementNode, loopsComplex, maximumComplex, minimumComplex):
    "Get rectangular grid."
    gridPath = []
    diameterReciprocal = complex(1.0 / diameter.real, 1.0 / diameter.imag)
    diameterSquared = diameter.real * diameter.real + diameter.imag * diameter.imag
    elements = int(
        math.ceil(derivation.density * euclidean.getAreaLoops(loopsComplex) / diameterSquared / math.sqrt(0.75))
    )
    elements = evaluate.getEvaluatedInt(elements, elementNode, "elements")
    failedPlacementAttempts = 0
    pixelDictionary = {}
    if derivation.seed != None:
        random.seed(derivation.seed)
    successfulPlacementAttempts = 0
    while failedPlacementAttempts < 100:
        point = euclidean.getRandomComplex(minimumComplex, maximumComplex)
        if getIsPointInsideZoneAwayOthers(diameterReciprocal, loopsComplex, point, pixelDictionary):
            gridPath.append(point)
            euclidean.addElementToPixelListFromPoint(point, pixelDictionary, point)
            successfulPlacementAttempts += 1
        else:
            failedPlacementAttempts += 1
        if successfulPlacementAttempts >= elements:
            return gridPath
    return gridPath
コード例 #14
0
def processXMLElement(xmlElement):
	"Process the xml element."
	face = Face()
	face.index = len( xmlElement.parent.object.faces )
	for vertexIndexIndex in xrange( 3 ):
		face.vertexIndexes.append( evaluate.getEvaluatedInt('vertex' + str(vertexIndexIndex), xmlElement ) )
	xmlElement.parent.object.faces.append( face )
コード例 #15
0
ファイル: write.py プロジェクト: malx122/Software
def writeElementNode(derivation, fileNames, target):
    "Write a quantity of the target."
    xmlObject = target.xmlObject
    if xmlObject == None:
        print('Warning, writeTarget in write could not get xmlObject for:')
        print(target)
        print(derivation.elementNode)
        return
    parserDirectory = os.path.dirname(
        derivation.elementNode.getOwnerDocument().fileName)
    absoluteFolderDirectory = os.path.abspath(
        os.path.join(parserDirectory, derivation.folderName))
    if '/models' not in absoluteFolderDirectory:
        print(
            'Warning, models/ was not in the absolute file path, so for security nothing will be done for:'
        )
        print(derivation.elementNode)
        print('For which the absolute folder path is:')
        print(absoluteFolderDirectory)
        print(
            'The write tool can only write a file which has models/ in the file path.'
        )
        print(
            'To write the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.'
        )
        return
    quantity = evaluate.getEvaluatedInt(1, target, 'quantity')
    for itemIndex in xrange(quantity):
        writeXMLObject(absoluteFolderDirectory, derivation, fileNames, target,
                       xmlObject)
コード例 #16
0
def getRandomGrid(derivation, diameter, elementNode, loopsComplex,
                  maximumComplex, minimumComplex):
    'Get rectangular grid.'
    gridPath = []
    diameterReciprocal = complex(1.0 / diameter.real, 1.0 / diameter.imag)
    diameterSquared = diameter.real * diameter.real + diameter.imag * diameter.imag
    elements = int(
        math.ceil(derivation.density * euclidean.getAreaLoops(loopsComplex) /
                  diameterSquared / math.sqrt(0.75)))
    elements = evaluate.getEvaluatedInt(elements, elementNode, 'elements')
    failedPlacementAttempts = 0
    pixelDictionary = {}
    if derivation.seed != None:
        random.seed(derivation.seed)
    successfulPlacementAttempts = 0
    while failedPlacementAttempts < 100:
        point = euclidean.getRandomComplex(minimumComplex, maximumComplex)
        if getIsPointInsideZoneAwayOthers(diameterReciprocal, loopsComplex,
                                          point, pixelDictionary):
            gridPath.append(point)
            euclidean.addElementToPixelListFromPoint(point, pixelDictionary,
                                                     point)
            successfulPlacementAttempts += 1
        else:
            failedPlacementAttempts += 1
        if successfulPlacementAttempts >= elements:
            return gridPath
    return gridPath
コード例 #17
0
ファイル: face.py プロジェクト: maestroflema/asimov
def processElementNode(elementNode):
	"Process the xml element."
	face = Face()
	face.index = len(elementNode.parentNode.xmlObject.faces)
	for vertexIndexIndex in xrange(3):
		face.vertexIndexes.append(evaluate.getEvaluatedInt(None, elementNode, 'vertex' + str(vertexIndexIndex)))
	elementNode.parentNode.xmlObject.faces.append(face)
コード例 #18
0
ファイル: grid.py プロジェクト: 3DNogi/SFACT
	def __init__(self, elementNode):
		self.inradius = lineation.getInradiusFirstByHeightWidth(complex(10.0, 10.0), elementNode)
		self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'radius', 'diameter', complex(1.0, 1.0))
		self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', elementNode, 'type')
		self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, 'zigzag')
コード例 #19
0
ファイル: grid.py プロジェクト: poikilos/Skeinforge50plus
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradiusFirstByHeightWidth(complex(10.0, 10.0), elementNode)
		self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'radius', 'diameter', complex(1.0, 1.0))
		self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', elementNode, 'type')
		self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, 'zigzag')
コード例 #20
0
ファイル: square.py プロジェクト: maestroflema/asimov
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradius(complex(1.0, 1.0), elementNode)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiwidth', 'width', self.inradius.real)
		self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiheight', 'height', self.inradius.imag)
		self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'bottomdemiwidth', 'bottomwidth', self.demiwidth)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'topdemiwidth', 'topwidth', self.demiwidth)
		self.interiorAngle = evaluate.getEvaluatedFloat(90.0, elementNode, 'interiorangle')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
コード例 #21
0
ファイル: square.py プロジェクト: folksjos/RepG
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradius(complex(1.0, 1.0), elementNode)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiwidth', 'width', self.inradius.real)
		self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiheight', 'height', self.inradius.imag)
		self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'bottomdemiwidth', 'bottomwidth', self.demiwidth)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'topdemiwidth', 'topwidth', self.demiwidth)
		self.interiorAngle = evaluate.getEvaluatedFloat(90.0, elementNode, 'interiorangle')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
コード例 #22
0
ファイル: square.py プロジェクト: Sciumo/SFACT
	def __init__(self, xmlElement):
		"""Set defaults."""
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(1.0, 1.0), xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', self.demiwidth, xmlElement)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', self.demiwidth, xmlElement)
		self.interiorAngle = evaluate.getEvaluatedFloat(90.0, 'interiorangle', xmlElement)
		self.revolutions = evaluate.getEvaluatedInt(1, 'revolutions', xmlElement)
		self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
コード例 #23
0
ファイル: square.py プロジェクト: CNCBASHER/skeinforge-1
	def __init__(self, xmlElement):
		'Set defaults.'
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(1.0, 1.0), xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', self.demiwidth, xmlElement)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', self.demiwidth, xmlElement)
		self.interiorAngle = evaluate.getEvaluatedFloat(90.0, 'interiorangle', xmlElement)
		self.revolutions = evaluate.getEvaluatedInt(1, 'revolutions', xmlElement)
		self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
コード例 #24
0
ファイル: shaft.py プロジェクト: mezl/ReplicatorG
 def __init__(self, elementNode):
     "Set defaults."
     self.depthBottomOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, "depthBottomOverRadius")
     self.depthTopOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, "depthOverRadius")
     self.depthTopOverRadius = evaluate.getEvaluatedFloat(self.depthTopOverRadius, elementNode, "depthTopOverRadius")
     self.radius = evaluate.getEvaluatedFloat(1.0, elementNode, "radius")
     self.sides = evaluate.getEvaluatedInt(4, elementNode, "sides")
     self.depthBottom = self.radius * self.depthBottomOverRadius
     self.depthBottom = evaluate.getEvaluatedFloat(self.depthBottom, elementNode, "depthBottom")
     self.depthTop = self.radius * self.depthTopOverRadius
     self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, elementNode, "depth")
     self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, elementNode, "depthTop")
コード例 #25
0
ファイル: square.py プロジェクト: Aeva/SFACT
 def __init__(self, elementNode):
     "Set defaults."
     self.inradius = lineation.getInradius(complex(1.0, 1.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "demiwidth", "width", self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, "demiheight", "height", self.inradius.imag)
     self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(
         elementNode, "bottomdemiwidth", "bottomwidth", self.demiwidth
     )
     self.topDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "topdemiwidth", "topwidth", self.demiwidth)
     self.interiorAngle = evaluate.getEvaluatedFloat(90.0, elementNode, "interiorangle")
     self.revolutions = evaluate.getEvaluatedInt(1, elementNode, "revolutions")
     self.spiral = evaluate.getVector3ByPrefix(None, elementNode, "spiral")
コード例 #26
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.depthBottomOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, 'depthBottomOverRadius')
		self.depthTopOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, 'depthOverRadius')
		self.depthTopOverRadius = evaluate.getEvaluatedFloat(
			self.depthTopOverRadius, elementNode, 'depthTopOverRadius')
		self.radius = evaluate.getEvaluatedFloat(1.0, elementNode, 'radius')
		self.sides = evaluate.getEvaluatedInt(4, elementNode, 'sides')
		self.depthBottom = self.radius * self.depthBottomOverRadius
		self.depthBottom = evaluate.getEvaluatedFloat(self.depthBottom, elementNode, 'depthBottom')
		self.depthTop = self.radius * self.depthTopOverRadius
		self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, elementNode, 'depth')
		self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, elementNode, 'depthTop')
コード例 #27
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.depthBottomOverRadius = evaluate.getEvaluatedFloat(0.0, 'depthBottomOverRadius', xmlElement)
		self.depthTopOverRadius = evaluate.getEvaluatedFloat(0.0, 'depthOverRadius', xmlElement)
		self.depthTopOverRadius = evaluate.getEvaluatedFloat(
			self.depthTopOverRadius, 'depthTopOverRadius', xmlElement)
		self.radius = evaluate.getEvaluatedFloat(1.0, 'radius', xmlElement)
		self.sides = evaluate.getEvaluatedInt(4, 'sides', xmlElement)
		self.depthBottom = self.radius * self.depthBottomOverRadius
		self.depthBottom = evaluate.getEvaluatedFloat(self.depthBottom, 'depthBottom', xmlElement)
		self.depthTop = self.radius * self.depthTopOverRadius
		self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, 'depth', xmlElement)
		self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, 'depthTop', xmlElement)
コード例 #28
0
ファイル: square.py プロジェクト: koenkooi/ReplicatorG
 def __init__(self, xmlElement):
     "Set defaults."
     self.inradius = lineation.getComplexByPrefixes(["demisize", "inradius"], complex(1.0, 1.0), xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(2.0, "size", self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd("demiwidth", "width", self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd("demiheight", "height", self.inradius.imag, xmlElement)
     self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(
         "bottomdemiwidth", "bottomwidth", self.demiwidth, xmlElement
     )
     self.topDemiwidth = lineation.getFloatByPrefixBeginEnd("topdemiwidth", "topwidth", self.demiwidth, xmlElement)
     self.interiorAngle = evaluate.getEvaluatedFloat(90.0, "interiorangle", xmlElement)
     self.revolutions = evaluate.getEvaluatedInt(1, "revolutions", xmlElement)
     self.spiral = evaluate.getVector3ByPrefix(None, "spiral", xmlElement)
コード例 #29
0
ファイル: shaft.py プロジェクト: schneider-engineering/SFACT
	def __init__(self, elementNode):
		'Set defaults.'
		self.depthBottomOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, 'depthBottomOverRadius')
		self.depthTopOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, 'depthOverRadius')
		self.depthTopOverRadius = evaluate.getEvaluatedFloat(
			self.depthTopOverRadius, elementNode, 'depthTopOverRadius')
		self.radius = evaluate.getEvaluatedFloat(1.0, elementNode, 'radius')
		self.sides = evaluate.getEvaluatedInt(4, elementNode, 'sides')
		self.depthBottom = self.radius * self.depthBottomOverRadius
		self.depthBottom = evaluate.getEvaluatedFloat(self.depthBottom, elementNode, 'depthBottom')
		self.depthTop = self.radius * self.depthTopOverRadius
		self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, elementNode, 'depth')
		self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, elementNode, 'depthTop')
コード例 #30
0
ファイル: lathe.py プロジェクト: Ademan/Cura
	def __init__(self, elementNode):
		'Set defaults.'
		self.axisEnd = evaluate.getVector3ByPrefix(None, elementNode, 'axisEnd')
		self.axisStart = evaluate.getVector3ByPrefix(None, elementNode, 'axisStart')
		self.end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
		self.loop = evaluate.getTransformedPathByKey([], elementNode, 'loop')
		self.sides = evaluate.getEvaluatedInt(None, elementNode, 'sides')
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		if len(self.target) < 1:
			print('Warning, no target in derive in lathe for:')
			print(elementNode)
			return
		firstPath = self.target[0]
		if len(firstPath) < 3:
			print('Warning, firstPath length is less than three in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		if self.axisStart == None:
			if self.axisEnd == None:
				self.axisStart = firstPath[0]
				self.axisEnd = firstPath[-1]
			else:
				self.axisStart = Vector3()
		self.axis = self.axisEnd - self.axisStart
		axisLength = abs(self.axis)
		if axisLength <= 0.0:
			print('Warning, axisLength is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		self.axis /= axisLength
		firstVector3 = firstPath[1] - self.axisStart
		firstVector3Length = abs(firstVector3)
		if firstVector3Length <= 0.0:
			print('Warning, firstVector3Length is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		firstVector3 /= firstVector3Length
		self.axisProjectiveSpace = euclidean.ProjectiveSpace().getByBasisZFirst(self.axis, firstVector3)
		if self.sides == None:
			distanceToLine = euclidean.getDistanceToLineByPaths(self.axisStart, self.axisEnd, self.target)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, distanceToLine)
		endRadian = math.radians(self.end)
		startRadian = math.radians(self.start)
		self.isEndCloseToStart = euclidean.getIsRadianClose(endRadian, startRadian)
		if len(self.loop) < 1:
			self.loop = euclidean.getComplexPolygonByStartEnd(endRadian, 1.0, self.sides, startRadian)
		self.normal = euclidean.getNormalByPath(firstPath)
コード例 #31
0
ファイル: lathe.py プロジェクト: folksjos/RepG
	def __init__(self, elementNode):
		'Set defaults.'
		self.axisEnd = evaluate.getVector3ByPrefix(None, elementNode, 'axisEnd')
		self.axisStart = evaluate.getVector3ByPrefix(None, elementNode, 'axisStart')
		self.end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
		self.loop = evaluate.getTransformedPathByKey([], elementNode, 'loop')
		self.sides = evaluate.getEvaluatedInt(None, elementNode, 'sides')
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		if len(self.target) < 1:
			print('Warning, no target in derive in lathe for:')
			print(elementNode)
			return
		firstPath = self.target[0]
		if len(firstPath) < 3:
			print('Warning, firstPath length is less than three in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		if self.axisStart == None:
			if self.axisEnd == None:
				self.axisStart = firstPath[0]
				self.axisEnd = firstPath[-1]
			else:
				self.axisStart = Vector3()
		self.axis = self.axisEnd - self.axisStart
		axisLength = abs(self.axis)
		if axisLength <= 0.0:
			print('Warning, axisLength is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		self.axis /= axisLength
		firstVector3 = firstPath[1] - self.axisStart
		firstVector3Length = abs(firstVector3)
		if firstVector3Length <= 0.0:
			print('Warning, firstVector3Length is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		firstVector3 /= firstVector3Length
		self.axisProjectiveSpace = euclidean.ProjectiveSpace().getByBasisZFirst(self.axis, firstVector3)
		if self.sides == None:
			distanceToLine = euclidean.getDistanceToLineByPaths(self.axisStart, self.axisEnd, self.target)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, distanceToLine)
		endRadian = math.radians(self.end)
		startRadian = math.radians(self.start)
		self.isEndCloseToStart = euclidean.getIsRadianClose(endRadian, startRadian)
		if len(self.loop) < 1:
			self.loop = euclidean.getComplexPolygonByStartEnd(endRadian, 1.0, self.sides, startRadian)
		self.normal = euclidean.getNormalByPath(firstPath)
コード例 #32
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.packingDensity = evaluate.getEvaluatedFloatByKeys(0.2, ['packingDensity', 'density'], xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		self.seed = evaluate.getEvaluatedInt(None, 'seed', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBoolean(True, 'zigzag', xmlElement)
コード例 #33
0
ファイル: grid.py プロジェクト: GottfriedSp/ReplicatorG
 def __init__(self, elementNode):
     "Set defaults."
     self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "demiwidth", "width", self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, "demiheight", "height", self.inradius.imag)
     self.density = evaluate.getEvaluatedFloat(0.2, elementNode, "density")
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, "elementRadius", "elementDiameter", complex(1.0, 1.0)
     )
     self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, "radius", "diameter", self.radius)
     self.seed = evaluate.getEvaluatedInt(None, elementNode, "seed")
     self.target = evaluate.getTransformedPathsByKey([], elementNode, "target")
     self.typeMenuRadioStrings = "hexagonal random rectangular".split()
     self.typeString = evaluate.getEvaluatedString("rectangular", elementNode, "type")
     self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, "zigzag")
コード例 #34
0
ファイル: shaft.py プロジェクト: CNCBASHER/skeinforge-1
 def __init__(self, xmlElement):
     'Set defaults.'
     self.depthBottomOverRadius = evaluate.getEvaluatedFloat(
         0.0, 'depthBottomOverRadius', xmlElement)
     self.depthTopOverRadius = evaluate.getEvaluatedFloat(
         0.0, 'depthOverRadius', xmlElement)
     self.depthTopOverRadius = evaluate.getEvaluatedFloat(
         self.depthTopOverRadius, 'depthTopOverRadius', xmlElement)
     self.radius = evaluate.getEvaluatedFloat(1.0, 'radius', xmlElement)
     self.sides = evaluate.getEvaluatedInt(4, 'sides', xmlElement)
     self.depthBottom = self.radius * self.depthBottomOverRadius
     self.depthBottom = evaluate.getEvaluatedFloat(self.depthBottom,
                                                   'depthBottom',
                                                   xmlElement)
     self.depthTop = self.radius * self.depthTopOverRadius
     self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, 'depth',
                                                xmlElement)
     self.depthTop = evaluate.getEvaluatedFloat(self.depthTop, 'depthTop',
                                                xmlElement)
コード例 #35
0
ファイル: write.py プロジェクト: 3DNogi/SFACT
def writeElementNode(derivation, fileNames, target):
	"Write a quantity of the target."
	xmlObject = target.xmlObject
	if xmlObject == None:
		print('Warning, writeTarget in write could not get xmlObject for:')
		print(target)
		print(derivation.elementNode)
		return
	parserDirectory = os.path.dirname(derivation.elementNode.getOwnerDocument().fileName)
	absoluteFolderDirectory = os.path.abspath(os.path.join(parserDirectory, derivation.folderName))
	if '/models' not in absoluteFolderDirectory:
		print('Warning, models/ was not in the absolute file path, so for security nothing will be done for:')
		print(derivation.elementNode)
		print('For which the absolute folder path is:')
		print(absoluteFolderDirectory)
		print('The write tool can only write a file which has models/ in the file path.')
		print('To write the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.')
		return
	quantity = evaluate.getEvaluatedInt(1, target, 'quantity')
	for itemIndex in xrange(quantity):
		writeXMLObject(absoluteFolderDirectory, derivation, fileNames, target, xmlObject)
コード例 #36
0
ファイル: grid.py プロジェクト: cjsatuforc/R2C2_Software
 def __init__(self, xmlElement):
     'Set defaults.'
     self.inradius = lineation.getComplexByPrefixes(
         ['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         'demiwidth', 'width', self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         'demiheight', 'height', self.inradius.imag, xmlElement)
     self.packingDensity = evaluate.getEvaluatedFloatByKeys(
         0.2, ['packingDensity', 'density'], xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     self.seed = evaluate.getEvaluatedInt(None, 'seed', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedString('rectangular', 'type',
                                                   xmlElement)
     self.zigzag = evaluate.getEvaluatedBoolean(True, 'zigzag', xmlElement)
コード例 #37
0
ファイル: lineation.py プロジェクト: 1060460048/Cura
def getNumberOfBezierPoints(begin, elementNode, end):
	'Get the numberOfBezierPoints.'
	numberOfBezierPoints = int(math.ceil(0.5 * evaluate.getSidesMinimumThreeBasedOnPrecision(elementNode, abs(end - begin))))
	return evaluate.getEvaluatedInt(numberOfBezierPoints, elementNode, 'sides')
コード例 #38
0
ファイル: lineation.py プロジェクト: Sciumo/SFACT
def getNumberOfBezierPoints(begin, end, xmlElement):
	"""Get the numberOfBezierPoints."""
	numberOfBezierPoints = int(math.ceil(0.5 * evaluate.getSidesMinimumThreeBasedOnPrecision(abs(end - begin), xmlElement)))
	return evaluate.getEvaluatedInt(numberOfBezierPoints, 'sides', xmlElement)
コード例 #39
0
ファイル: lineation.py プロジェクト: folksjos/RepG
def getNumberOfBezierPoints(begin, elementNode, end):
    'Get the numberOfBezierPoints.'
    numberOfBezierPoints = int(
        math.ceil(0.5 * evaluate.getSidesMinimumThreeBasedOnPrecision(
            elementNode, abs(end - begin))))
    return evaluate.getEvaluatedInt(numberOfBezierPoints, elementNode, 'sides')