Jump to content

Patrick Winkler

Member
  • Posts

    225
  • Joined

  • Last visited

Everything posted by Patrick Winkler

  1. Do you mean the copy node? Hav tried this but somehow it did not produce a copy of the objects.
  2. The problem is SetLinksObject in the node definition . If this property is set the objects are not complete at the point where the Compose-Node is executed. You can disabled the property in the line nodes but then the lines from the previous execution will not get replaced by the new ones. @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): this = Marionette.Node( "Line" ) this.SetDescription( "Creates a new 2D line in the drawing" ) start = Marionette.PortIn( (0,0) ) start.SetDescription( "the line's start point" ) end = Marionette.PortIn( (1,0) ) end.SetDescription( "the line's end point" ) lineH = Marionette.PortOut( "line" ) lineH.SetDescription( "the newly created line" ) #this.SetLinksObjects() # <<<----------- def RunNode(self): vs.MoveTo(self.Params.start.value) vs.LineTo(self.Params.end.value) self.Params.lineH.value = vs.LNewObj()
  3. Version 6: Now you can define filter conditions as Python statement in the oip of the node. X is replaced by the values. Check out the example in vwx: print_node_V6.vwx
  4. @Alan Woodwell No Panic. The arc 's are idiot proof you just have to copy and paste the nodes for checking the value.
  5. The new slider-nodes have been integraded today. Here is a demonstration: Color_RangeVideo.mov Color_Spectrum_V3_1_v2017.vwx
  6. Hi RuudB, here is a node for composing objects based on the function 'DoMenuTextByName'. Compose.vwx
  7. The trick is to use the Set Marker Node The markers are described on the Appendix site. Here is a little example (Marker 3 goes crazy): marker_example.vwx
  8. Update Version 5: - Print the input to a file -Choose the class for the text object print_node_V5.vwx.zip
  9. Nice! It's very relaxing to watch these circles dance. Have you shared the defintion for the animation I could not find it?
  10. I was able generate and export a range of images but unfortunately they look all the same. I have also tried to iterate trough the list of objs in a loop but this leads to the Error: 'Menu Copy is disabled'. vs.CreateImageFromPaint(paint, imageName) crashes VW.
  11. Great idea! I think the criteria is the problem. The Copy command works fine in this node: @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): this = Marionette.Node( 'Copy and Paste As Picture' ) this.SetDescription( 'Do nothing node. It just passes the input to the output: y = x' ) this.SetListAbsorb() x = Marionette.PortIn( [] ) x.SetDescription( "input" ) pic = Marionette.PortOut() pic.SetDescription( "Handle of the picture" ) def RunNode(self): vs.DoMenuTextByName('Copy',0) vs.DoMenuTextByName('Paste As Picture',0) h_pic = vs.LActLayer() # vs.LNewObj Failed in this situation! if vs.GetTypeN(h_pic) == 14: # BitMap self.Params.pic.value = h_pic else: self.Params.pic.value = 'Something went wrong'
  12. Hi michael, here is a dirty solution: You could check the parent of the object. If it's a wall set the layer as parent.
  13. Hi Penuelas, the gradient of a class can be set with this function: SetClFPat ('classX', -17) To get the index of you're desired gradient greate an object assign the gradient to it and then run this function. GetFPat(h) Maybe theres an easier way.
  14. Alan, you tried to use the path as point for the image import function def RunNode(self): #import os importPt_ = self.Params.importPt.value # Changed GetFile by GetFileN succes, fileName = vs.GetFileN('???', None, None) if succes: #fullReadPath, fullWritePath, readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission = vs.GetFileInfo(fileName) #name, ext = os.path.splitext( fileName ) #if ext.lower() == '.png' or ext.lower() == '.jpg': #imagePath = os.path.join( fullReadPath, fileName ) hImage = vs.ImportImageFile( fileName, importPt_ ) # This line should be within the if block otherwise you could return the wrong object! self.Params.hImage.value = hImage
  15. Hi Alan, I can't look into your file at the moment so I'm not sure what the problem is. But maybe the chunk node can solve it. name-nodes -> chunk by the number of name nodes (using get length) -> ... Patrick
  16. Hi Alan, index2name is what you are looking for.
  17. This Node filters the incoming objects by a criteria. Basicaly it's the ObjsByCrit node which just checks if the matching objs are on the input list. The Example example might not make many sence because you can combine criterias with '&'. But it can be usefull in other cases.
  18. It's the VW Example PIO After a long struggle I got it to work: def event_handler (): ''' Manages all events of the pio. ''' event, button = vs.vsoGetEventInfo() debug_info = '' # DBG if event == vsoEventsConstants.kObjOnInitXProperties: # Initialication should only be triggered once at the createn vs.SetObjPropVS ( vsoEventsConstants.kObjXPropPreference, True) vs.SetObjPropVS ( vsoEventsConstants.kObjXPropAcceptStates , True) vs.SetObjPropVS (vsoEventsConstants.kObjXPropSpecialEdit, True) # Set the Double-Click behaviour #vs.SetObjPropCharVS (vsoEventsConstants.kObjXPropSpecialEdit, vs.Chr( vsoEventsConstants.kCustomSpecialEdit) ) debug_info = 'kObjOnInitXProperties' elif event == vsoEventsConstants.kResetEventID: # 3 vs.vsoStateClear (gObjHandle) draw_geometry() debug_info ='kResetEventID' elif event == vsoEventsConstants.kOnObjPrefEventID: # 4 debug_info = 'kOnObjPrefEventID' elif event == vsoEventsConstants.kObjOnSpecialEditID: # 7 vs.AlrtDialog('Show Setting Dialog') debug_info = 'kObjXPropSpecialEdit' # DBG return 'Last Update: {time} \r Event: {evnt}, Button {but}\r Debug-Info: {dbg_info}'.format ( time = datetime.utcnow() , evnt = event, but = button, dbg_info = debug_info ) thanks.
  19. Hi Alan, the contents node (operations category) gives you the sub objs of a object. Try it...
  20. Hello, I tried to call a costum dialog when a doubleclick on my pio is done. VectorLabs provides a example but It just won't work in my script. kObjOnInitXProperties gets never triggered and even if I call result := SetObjPropVS(kObjXPropPreference, TRUE); on every reset it will not work. http://www.vectorlab.info/index.php?title=Events // Exanple from VectorLab // Object with a custom preference dialog: PROCEDURE Example1; CONST kObjOnInitXProperties = 5; kObjXPropPreference = 4; kOnObjPrefEventID = 4; kResetEventID = 3; VAR theEvent, theButton :LONGINT; result :BOOLEAN; BEGIN // I translated this into Python and integrated it into my Pio vsoGetEventInfo(theEvent, theButton); CASE theEvent OF {User has single-clicked the object's icon.} kObjOnInitXProperties: BEGIN {This tells VW to pass the preference event back to this object, as the kOnObjPrefEventID event, instead of calling the built-in preference handler, which pops up the Object Properties dialog.} result := SetObjPropVS(kObjXPropPreference, TRUE); END; {User has clicked the Preferences button in the Mode bar, or double-clicked the object in the drawing (see example 9). This event will never happen if the kObjXPropPreference property is not set to TRUE in the initialization event (above).} kOnObjPrefEventID: BEGIN {Typically this dialog accepts user input and uses SetRField to write the values to the object's record definition handle.} AlrtDialog('Custom Preference Dialog'); END; {Object reset has been called.} kResetEventID: BEGIN Rect(0, 0, 1, 1); END; END; END; RUN(Example1); # My Code event, button = vs.vsoGetEventInfo() if event == kObjOnInitXProperties: result = vs.SetObjPropVS (kObjXPropPreference, True) vs.AlrtDialog ('Init') elif event == kOnObjPrefEventID: vs.AlrtDialog('CostumDLG.') elif event == kResetEventID: # DBG result = vs.SetObjPropVS (kObjXPropPreference, True) vs.AlrtDialog('Reset.') The red marked Text says that the object can't be edited on this way when I double click it.
  21. Alan, have you tried it with doms mesh-Node: Points To Mesh
  22. Howdy, tought the same but None is not recocnized as the None class in the germ version. Yes vs.Index2Name(2) gives me 'Keine'. Just found another flaw. The coordinates of objects on other layers are changed by the script. In order to prevent that I just move erverything in the doc. This hasn't been tested well! def center_drawing_on_internal_origin (): ''' Moves everything on the active layer to the Origin, then moves the User Origin to maintain the same XY readings. 11 Jul 2016 - Raymond J Mullin ''' def get_None_class (): return vs.Index2Name(2) vs.NameClass (get_None_class()) # Klasse keine aktiv setzen (OrigX, OrigY) = vs.GetOriginInDocUnits () # Group all objs on the active Layer vs.SelectAll() # ??? Select / Get all Objs in the doc? vs.Group() group_h = vs.LActLayer() (group_cen_X, group_center_Y) = vs.HCenter (group_h) Vx = -group_cen_X - OrigX Vy = -group_center_Y - OrigY vs.Ungroup() def move (h): vs.HMove( h, Vx, Vy) ForEachObject (move, 'ALL') # Optional, to retain the same x&y after the move vs.SetOrigin (Vx, Vy); # remove to keep drawing center unchanged
  23. You can also get objs by criteria. I've made a little example which shows just two of nearly endless possibilities.
  24. Hi Marissa, This node is kind of danger since it creates a duplicate of the obj and deletes the original. Here is an alternative: @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): this = Marionette.Node( "Set Layer" ) this.SetDescription( 'Adds an object to a specified layer' ) object = Marionette.PortIn(vs.Handle(0), 'obj') object.SetDescription( "The input object" ) layer_name = Marionette.PortIn( None ) layer_name.SetDescription( "Name of the layer." ) obj = Marionette.PortOut() obj.SetDescription( "The result object" ) def RunNode(self): obj = self.Params.object.value layer_name = self.Params.layer_name.value # Creates the layer if it not alreay exists vs.Layer (layer_name) # Get the handle to the layer lay_h = vs.GetLayerByName (layer_name) vs.SetParent (obj, lay_h) self.Params.obj.value = obj
×
×
  • Create New...