Example #1
0
def run_visualize(self,*args, **kwargs):
    say(self._rawNode)
    say("create vid3d object in graph")
    gg=self.graph()
    x,y=-150,-100
    nodeClass='FreeCAD_view3D'
    #t3 = pfwrap.createNode('PyFlowFreeCAD',nodeClass,"MyPolygon")
    #t3.setPosition(x,y)
    #gg.addNode(t3)
    #uinode=createUINode(t3)
    #say(uinode)
    aa=self.canvasRef().spawnNode(nodeClass, x, y)
    say(aa.__class__)
    say("connect Shape withj vie3d.shape ...")
    FreeCAD.aa=aa
    FreeCAD.aa=self._rawNode['outExec']
    pfwrap.connect(self._rawNode,'Shape_out',aa._rawNode,'Shape_in')

    aa._rawNode.setData('name','View_'+self._rawNode.name)

    if self._rawNode["outExec"].hasConnections():
        for pin in self._rawNode["outExec"].affects:
            pfwrap.connect(self._rawNode,'outExec',aa._rawNode,'inExec')
            pfwrap.connect(aa._rawNode,'outExec',pin.owningNode(),pin.name)
    pfwrap.connect(self._rawNode,'outExec',aa._rawNode,'inExec')

    #refrehs view
    instance=pfwrap.getInstance()
    data = instance.graphManager.get().serialize()
    instance.graphManager.get().clear()
    instance.loadFromData(data)
Example #2
0
instance = pfwrap.getInstance()
gg = pfwrap.getGraphManager().getAllGraphs()[0]

_FreeCAD_ImportFile = pfwrap.createNode('PyFlowFreeCAD', 'FreeCAD_ImportFile',
                                        'FreeCAD_ImportFile')
_FreeCAD_ImportFile.setPosition(-463.0, -97.0)
gg.addNode(_FreeCAD_ImportFile)

_FreeCAD_Elevation = pfwrap.createNode('PyFlowFreeCAD', 'FreeCAD_Elevation',
                                       'FreeCAD_Elevation')
_FreeCAD_Elevation.setPosition(-292.0, -209.0)
gg.addNode(_FreeCAD_Elevation)

_FreeCAD_BSplineSurface = pfwrap.createNode('PyFlowFreeCAD',
                                            'FreeCAD_BSplineSurface',
                                            'FreeCAD_BSplineSurface')
_FreeCAD_BSplineSurface.setPosition(-77.0, -244.0)
gg.addNode(_FreeCAD_BSplineSurface)

_FreeCAD_Polygon = pfwrap.createNode('PyFlowFreeCAD', 'FreeCAD_Polygon',
                                     'FreeCAD_Polygon')
_FreeCAD_Polygon.setPosition(-266.0, 12.0)
gg.addNode(_FreeCAD_Polygon)

pfwrap.connect(_FreeCAD_ImportFile, 'points', _FreeCAD_Polygon, 'points')
pfwrap.connect(_FreeCAD_ImportFile, 'points', _FreeCAD_Elevation, 'points')
pfwrap.connect(_FreeCAD_Elevation, 'outExec', _FreeCAD_BSplineSurface,
               'inExec')
pfwrap.connect(_FreeCAD_Elevation, 'poles', _FreeCAD_BSplineSurface, 'poles')
nodeeditor.Commands.refresh_gui()
import nodeeditor
import nodeeditor.pfwrap as pfwrap
instance = pfwrap.getInstance()
gg = pfwrap.getGraphManager().getAllGraphs()[0]

_strftime = pfwrap.createFunction('PyFlowFreeCAD', 'Datetime', 'strftime')
_strftime.setPosition(-32.0, -251.0)
gg.addNode(_strftime)

_time = pfwrap.createFunction('PyFlowFreeCAD', 'Datetime', 'time')
_time.setPosition(-264.0, -326.0)
gg.addNode(_time)

_now = pfwrap.createFunction('PyFlowFreeCAD', 'Datetime', 'now')
_now.setPosition(-328.0, -205.0)
gg.addNode(_now)

pfwrap.connect(_now, 'out', _strftime, 'timestamp')
nodeeditor.Commands.refresh_gui()
Example #4
0
gg.addNode(_FreeCAD_Import)

_makeString = pfwrap.createFunction('PyFlowBase', 'DefaultLib', 'makeString')
_makeString.setPosition(-205.0, -146.0)
gg.addNode(_makeString)

_FreeCAD_VectorArray = pfwrap.createNode('PyFlowFreeCAD',
                                         'FreeCAD_VectorArray',
                                         'FreeCAD_VectorArray')
_FreeCAD_VectorArray.setPosition(-365.0, -295.0)
gg.addNode(_FreeCAD_VectorArray)

_FreeCAD_View3D = pfwrap.createNode('PyFlowFreeCAD', 'FreeCAD_View3D',
                                    'FreeCAD_View3D')
_FreeCAD_View3D.setPosition(257.0, -299.0)
gg.addNode(_FreeCAD_View3D)

_makeString.setData('s', '/tmp/aa.brep')
_FreeCAD_VectorArray.setData('countA', 50)
_FreeCAD_VectorArray.setData('countB', 50)
_FreeCAD_VectorArray.setData('randomZ', 20)

pfwrap.connect(_FreeCAD_Export, 'outExec', _FreeCAD_Import, 'inExec')
pfwrap.connect(_FreeCAD_Import, 'outExec', _FreeCAD_View3D, 'inExec')
pfwrap.connect(_FreeCAD_Import, 'Shape_out', _FreeCAD_View3D, 'Shape_in')
pfwrap.connect(_makeString, 'out', _FreeCAD_Import, 'filename')
pfwrap.connect(_makeString, 'out', _FreeCAD_Export, 'filename')
pfwrap.connect(_FreeCAD_VectorArray, 'outExec', _FreeCAD_Export, 'inExec')
pfwrap.connect(_FreeCAD_VectorArray, 'Shape_out', _FreeCAD_Export, 'Shape')
nodeeditor.Commands.refresh_gui()
Example #5
0
_FreeCAD_Expression.setPosition(-11.0, -208.0)
gg.addNode(_FreeCAD_Expression)

_makeInt = pfwrap.createFunction('PyFlowBase', 'DefaultLib', 'makeInt')
_makeInt.setPosition(-201.0, -191.0)
gg.addNode(_makeInt)

_makeFloat = pfwrap.createFunction('PyFlowBase', 'DefaultLib', 'makeFloat')
_makeFloat.setPosition(-241.0, -129.0)
gg.addNode(_makeFloat)

_makeInt1 = pfwrap.createFunction('PyFlowBase', 'DefaultLib', 'makeInt')
_makeInt1.setPosition(-238.0, -12.0)
gg.addNode(_makeInt1)

pfwrap.connect(_makeInt, 'out', _FreeCAD_Expression, 'a')
pfwrap.connect(_makeFloat, 'out', _FreeCAD_Expression, 'b')
pfwrap.connect(_makeFloat, 'out', _FreeCAD_Expression, 'c')
pfwrap.connect(_makeInt1, 'out', _FreeCAD_Expression, 'd')

_makeInt.setData('i', 100)
_makeInt.setData('i', 50)
_makeFloat.setData('f', 10.10)

_FreeCAD_Expression.setData('modules', 'time')
_FreeCAD_Expression.setData('expression', 'time.time()*0+a+b*c+d')

_FreeCAD_Expression.compute()

assert _FreeCAD_Expression.getData('float_out') == 152.01
Example #6
0
_FreeCAD_Dragger.setPosition(342.8726233010518, -195.9047950601577)
gg.addNode(_FreeCAD_Dragger)

#FreeCAD_Dragger.setData(pinname,value)

_sequence = pfwrap.createNode('PyFlowBase', 'sequence', 'sequence')
_sequence.setPosition(103.3020351325444, -430.13788679513476)
gg.addNode(_sequence)

#sequence.setData(pinname,value)

_FreeCAD_ShapePattern4 = pfwrap.createNode('PyFlowFreeCAD',
                                           'FreeCAD_ShapePattern',
                                           'FreeCAD_ShapePattern4')
_FreeCAD_ShapePattern4.setPosition(501.0, -134.0)
gg.addNode(_FreeCAD_ShapePattern4)

#FreeCAD_ShapePattern4.setData(pinname,value)

pfwrap.connect(_FreeCAD_VectorArray, 'Shape_out', _FreeCAD_Tripod, 'Shape')
pfwrap.connect(_FreeCAD_Tripod, 'outExec', _sequence, 'inExec')
pfwrap.connect(_FreeCAD_Tripod, 'poles', _FreeCAD_ShapePattern, 'points')
pfwrap.connect(_FreeCAD_Tripod, 'poles', _FreeCAD_Dragger, 'points')
pfwrap.connect(_FreeCAD_Dragger, 'outExec', _FreeCAD_ShapePattern4, 'inExec')
pfwrap.connect(_FreeCAD_Dragger, 'Points_out', _FreeCAD_ShapePattern4,
               'points')
pfwrap.connect(_sequence, '1', _FreeCAD_ShapePattern, 'inExec')
pfwrap.connect(_sequence, '2', _FreeCAD_Dragger, 'reset')
pfwrap.connect(_sequence, '3', _FreeCAD_Dragger, 'start')
nodeeditor.Commands.refresh_gui()
Example #7
0
import nodeeditor.pfwrap as pfwrap
instance = pfwrap.getInstance()
gg = pfwrap.getGraphManager().getAllGraphs()[0]

_FreeCAD_VectorArray = pfwrap.createNode('PyFlowFreeCAD',
                                         'FreeCAD_VectorArray',
                                         'FreeCAD_VectorArray')
_FreeCAD_VectorArray.setPosition(-228.6921223730601, -215.2858684530729)
gg.addNode(_FreeCAD_VectorArray)

#FreeCAD_VectorArray.setData(pinname,value)

_FreeCAD_QuadMesh = pfwrap.createNode('PyFlowFreeCAD', 'FreeCAD_QuadMesh',
                                      'FreeCAD_QuadMesh')
_FreeCAD_QuadMesh.setPosition(-88.19496953179734, -92.19081735231327)
gg.addNode(_FreeCAD_QuadMesh)

#FreeCAD_QuadMesh.setData(pinname,value)

_FreeCAD_View3D = pfwrap.createNode('PyFlowFreeCAD', 'FreeCAD_View3D',
                                    'FreeCAD_View3D')
_FreeCAD_View3D.setPosition(-76.51980075617351, -259.0598351580601)
gg.addNode(_FreeCAD_View3D)

#FreeCAD_View3D.setData(pinname,value)

pfwrap.connect(_FreeCAD_VectorArray, 'Shape_out', _FreeCAD_View3D, 'Shape_in')
pfwrap.connect(_FreeCAD_VectorArray, 'vectors_out', _FreeCAD_QuadMesh,
               'points')
nodeeditor.Commands.refresh_gui()