def getManipulatedPaths(close, loop, prefix, xmlElement): "Get array path." arrayPaths = evaluate.getPathsByKeys([prefix + 'path', prefix + 'paths'], xmlElement) manipulatedByPaths = [] for arrayPath in arrayPaths: for arrayPoint in arrayPath: manipulatedByPath = [] for point in loop: manipulatedByPath.append(point + arrayPoint) manipulatedByPaths.append(manipulatedByPath) manipulatedByVertices = [] vertices = getVerticesByKey(prefix + 'vertices', xmlElement) for vertex in vertices: manipulatedByVertex = [] for point in loop: manipulatedByVertex.append(point + vertex) manipulatedByVertices.append(manipulatedByVertex) manipulatedPaths = manipulatedByPaths + manipulatedByVertices if len(manipulatedPaths) == 0: print( 'Warning, in getManipulatedPaths in array there are no paths or vertices for:' ) print(xmlElement) return [loop] return manipulatedPaths
def getGeometryOutput(xmlElement): "Get triangle mesh from attribute dictionary." geometryOutput = [] paths = evaluate.getPathsByKeys( ['path', 'paths', 'target'], xmlElement ) for path in paths: sideLoop = SideLoop( path ) geometryOutput += getGeometryOutputByLoop( sideLoop, xmlElement ) return getUnpackedLoops( geometryOutput )
def getGeometryOutput(xmlElement): "Get geometry output from paths." geometryOutput = [] paths = evaluate.getPathsByKeys( ['path', 'paths', 'target'], xmlElement ) for path in paths: sideLoop = SideLoop(path) geometryOutput += getGeometryOutputByLoop( sideLoop, xmlElement ) return getUnpackedLoops(geometryOutput)
def getGeometryOutput(xmlElement): "Get geometry output from paths." geometryOutput = [] paths = evaluate.getPathsByKeys(['path', 'paths', 'target'], xmlElement) for path in paths: sideLoop = SideLoop(path) geometryOutput += getGeometryOutputByLoop(sideLoop, xmlElement) return getUnpackedLoops(geometryOutput)
def getGeometryOutput(xmlElement): "Get triangle mesh from attribute dictionary." geometryOutput = [] paths = evaluate.getPathsByKeys( ['path', 'paths', 'target'], xmlElement ) for path in paths: sideLoop = SideLoop(path) geometryOutput += getGeometryOutputByLoop( sideLoop, xmlElement ) return getUnpackedLoops(geometryOutput)
def getGeometryOutputByFunction( manipulationFunction, xmlElement ): "Get geometry output from paths and manipulationFunction." geometryOutput = [] paths = evaluate.getPathsByKeys( [ 'path', 'paths', 'target' ], xmlElement ) for path in paths: sideLoop = SideLoop( path ) geometryOutput += getGeometryOutputByLoop( manipulationFunction, sideLoop, xmlElement ) return getUnpackedLoops( geometryOutput )
def getGeometryOutput(xmlElement): "Get vector3 vertices from attribute dictionary." paths = evaluate.getPathsByKeys(['crosssection', 'section', 'target'], xmlElement) if len(euclidean.getConcatenatedList(paths)) == 0: print('Warning, in extrude there are no paths.') print(xmlElement.attributeDictionary) return None offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)] extrude = Extrude() extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault( extrude.tiltFollow, 'tiltfollow', xmlElement) extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop, xmlElement) extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault( 5.0, 'maximumunbuckling', xmlElement) scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)] extrude.interpolationDictionary['scale'] = evaluate.Interpolation( ).getByPrefixZ(scalePathDefault, 'scale', xmlElement) if extrude.tiltTop == None: extrude.interpolationDictionary['offset'] = evaluate.Interpolation( ).getByPrefixZ(offsetPathDefault, '', xmlElement) tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)] interpolationTilt = evaluate.Interpolation().getByPrefixZ( tiltPathDefault, 'tilt', xmlElement) extrude.interpolationDictionary['tilt'] = interpolationTilt for point in interpolationTilt.path: point.x = math.radians(point.x) point.y = math.radians(point.y) else: offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)] extrude.interpolationDictionary['offset'] = evaluate.Interpolation( ).getByPrefixAlong(offsetAlongDefault, '', xmlElement) insertTwistPortions(extrude.interpolationDictionary, xmlElement) segments = evaluate.getEvaluatedIntOne('segments', xmlElement) negatives = [] positives = [] portionDirections = evaluate.getSpacedPortionDirections( extrude.interpolationDictionary) for path in paths: endMultiplier = None if not euclidean.getIsWiddershinsByVector3(path): endMultiplier = 1.000001 geometryOutput = getGeometryOutputByPath(endMultiplier, extrude, path, portionDirections) if endMultiplier == None: positives.append(geometryOutput) else: negatives.append(geometryOutput) positiveOutput = trianglemesh.getUnifiedOutput(positives) if len(negatives) < 1: return positiveOutput return {'difference': [positiveOutput] + negatives}
def getGeometryOutput(xmlElement): "Get triangle mesh from attribute dictionary." paths = evaluate.getPathsByKeys( ['crosssection', 'section', 'target'], xmlElement ) if len( euclidean.getConcatenatedList( paths ) ) == 0: print('Warning, in extrude there are no paths.') print( xmlElement.attributeDictionary ) return None offsetPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ] extrude = Extrude() extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault( extrude.tiltFollow, 'tiltfollow', xmlElement ) extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop, xmlElement ) extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault( 5.0, 'maximumunbuckling', xmlElement ) scalePathDefault = [ Vector3( 1.0, 1.0, 0.0 ), Vector3( 1.0, 1.0, 1.0 ) ] extrude.interpolationDictionary['scale'] = Interpolation().getByPrefixZ( scalePathDefault, 'scale', xmlElement ) if extrude.tiltTop == None: extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixZ( offsetPathDefault, '', xmlElement ) tiltPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ] interpolationTilt = Interpolation().getByPrefixZ( tiltPathDefault, 'tilt', xmlElement ) extrude.interpolationDictionary['tilt'] = interpolationTilt for point in interpolationTilt.path: point.x = math.radians( point.x ) point.y = math.radians( point.y ) else: offsetAlongDefault = [ Vector3(), Vector3( 1.0, 0.0, 0.0 ) ] extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong( offsetAlongDefault, '', xmlElement ) insertTwistPortions( extrude.interpolationDictionary, xmlElement ) segments = evaluate.getEvaluatedIntOne('segments', xmlElement ) negatives = [] positives = [] portionDirections = getSpacedPortionDirections( extrude.interpolationDictionary ) for path in paths: endMultiplier = None if not euclidean.getIsWiddershinsByVector3( path ): endMultiplier = 1.000001 geometryOutput = getGeometryOutputByPath( endMultiplier, extrude, path, portionDirections ) if endMultiplier == None: positives.append( geometryOutput ) else: negatives.append( geometryOutput ) positiveOutput = trianglemesh.getUnifiedOutput( positives ) interpolationOffset = extrude.interpolationDictionary['offset'] if len( negatives ) < 1: return getGeometryOutputWithConnection( positiveOutput, interpolationOffset, xmlElement ) return getGeometryOutputWithConnection( { 'difference' : [ positiveOutput ] + negatives }, interpolationOffset, xmlElement )
def getManipulatedPaths( close, loop, prefix, xmlElement ): "Get array path." arrayPaths = evaluate.getPathsByKeys( [ prefix + 'path', prefix + 'paths' ], xmlElement ) manipulatedByPaths = [] for arrayPath in arrayPaths: for arrayPoint in arrayPath: manipulatedByPath = [] for point in loop: manipulatedByPath.append( point + arrayPoint ) manipulatedByPaths.append( manipulatedByPath ) manipulatedByVertices = [] vertices = getVerticesByKey( prefix + 'vertices', xmlElement ) for vertex in vertices: manipulatedByVertex = [] for point in loop: manipulatedByVertex.append( point + vertex ) manipulatedByVertices.append( manipulatedByVertex ) manipulatedPaths = manipulatedByPaths + manipulatedByVertices if len( manipulatedPaths ) == 0: print( 'Warning, in getManipulatedPaths in array there are no paths or vertices for:' ) print( xmlElement ) return [ loop ] return manipulatedPaths