Jump to content

Patrick Winkler

  • Posts

  • Joined

  • Last visited


48 Great

Personal Information

  • Occupation
    Software Developer
  • Location

Recent Profile Visitors

3,237 profile views
  1. Thanks, I will copy your explanation into the wiki if you don't mind.
  2. I'm not sure which resoltuion to use for ConvertToPolygon(). http://developer.vectorworks.net/index.php/VS:ConvertToPolygon <50 is obvious to less. 90 and 100 convert a cirlce to 32pt polys and 150 to 64 pt polys. In this case 90 should be enough as even in renderworks my eyes can't spot a difference to the higher resolutions. It would be good to know how the resoltution effects the outcome (why do 90, 100 create the same ) and if there is a maximum value. regards, Patrick
  3. To make sure the center stays at the same location the bounding box must always have the same size. This can be accomplished by palcing an invisible circle into the symbol. ( set fill and penstyle to empty.)
  4. This node gives you the center of the Bounding Box. ''' Changed on 22.02.2016 : Wrong Var was used in the calcul. of the center Changed on 04.04.2016 : Created the 'def GetBBoxN (h)' Changed on 18.04.2016 : set Initialize function: Marionette.InitializeView Changed on 27.11.2017 : Force TopView author: patrick winkler ''' import vs import Marionette @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): this = Marionette.Node( 'Get Bounding Box' ) this.SetDescription("Returns the bounding box's coordinates of the projection of an object on the screen plane") # IMPORTANT: SetThe View to Top while Execution - The BB Values are otherwise incorrect!!!! this.SetInitFunc(Marionette.InitializeView) this.SetFinalFunc (Marionette.RestoreView) obj = Marionette.PortIn(vs.Handle(0)) obj.SetDescription( "The input object" ) topL2D = Marionette.PortOut() topL2D.SetDescription( "The top left coordinates of the bounding box" ) botR2D = Marionette.PortOut() botR2D.SetDescription( "The bottom right coordinatesr of the bounding box" ) width = Marionette.PortOut() width.SetDescription("The width of the bounding box.") height = Marionette.PortOut() height.SetDescription("The height of the bounding box.") center = Marionette.PortOut() center.SetDescription("The centerpoint of the bounding box.") def RunNode(self): def GetBBoxN (h, top_view = True): ''' Returns top left point, bottom right point, width, height and center of the object bounding box (as tuple). IMPORTANT: The result depends on the view in VW if top_view is False. ''' if top_view: # Change the view to Top temporarily orig_view = vs.GetView() vs.SetView(0, 0, 0, 0, 0, 0) box = vs.GetBBox(h) topL2D = box[0] botR2D = box[1] center = [None, None] BB_width = botR2D[0] - topL2D[0] BB_height = topL2D[1] - botR2D[1] center[0] = topL2D[0] + BB_width / 2 center[1] = topL2D[1] - BB_height / 2 center = tuple (center) if top_view: # Restore the original view xAngle, yAngle, zAngle, offset = orig_view xDistance, yDistance, zDistance = offset vs.SetView(xAngle, yAngle, zAngle, xDistance, yDistance, zDistance) return (topL2D, botR2D, BB_width, BB_height, center) obj = self.Params.obj.value if not obj: raise ValueError('No object handle was provided!') topL2D, botR2D, BB_width, BB_height, center = GetBBoxN(obj, top_view = True) # SET THE OUT PORTS self.Params.topL2D.value = topL2D self.Params.botR2D.value = botR2D self.Params.width.value = BB_width self.Params.height.value = BB_height self.Params.center.value = tuple (center)
  5. I looked it up in the source This list should contain all the real nams. univ_nams.txt
  6. The internal name can differ from the display name. In your case it's Rebuild Curve/Surface regards, Patrick
  7. Version 1.0.0


    This script converts the provided object into a NURBS and puts X points alog it.
  8. It might be obvious but I can't find the fucntion that returns the active LineStyle (Attribute Palette). Can someone give me a hint. http://developer.vectorworks.net/index.php/VS:Function_Reference#Document_Attributes Patrick
  9. You can find additional indo and more examples on http://www.vectorlab.info I would recommend you pyodbc (or pypyodbc*) for the sql connection. It is easy to use, more stable and performs better than the vs. functions. * Almost totally same usage as pyodbc ( can be seen as a re-implementation of pyodbc in pure Python )
  10. Version 1.0.0


    This little script flattens all the 3D Polys in the drawing to 0 and converts them into 2D polys without removing the attached database. 3D_Polys_to_2D_VW2017.vwx
  11. Hello, I need to call a Pythonscript (200 Lines!) wrappt in a VectorScript. Can you tell me how to get it between the brackets in VS? PythonExecute ( ?Load Pythonscript from external file? )
  12. Function is a great timesaver node. Here is a version with two more optional params. I have to contain myself from using it to extensive because the readability of the code could suffer. It would be great for the future if the function was displayed on the node. function_N.vwx
  13. Couldn't find a description in the online help. How is it done?
  14. thanks Dom, I wonder why the criteria-dialog only calls a string-dlg as there is a more sophisticated dialog available. Here is the alternative version: crit_dlg_N.vwx.zip
  • Create New...