Jump to content

Paolo

Member
  • Posts

    181
  • Joined

  • Last visited

File Comments posted by Paolo

  1. Hello Dom,

    I use this precious piece of software to cut needed parts on a CNC machine, thank you very much!

     

    I often have to indicate, in the output,  other conventional signs/geometry (for CNC extra work as blind holes for hinge housing, edging etc.).

    I was trying to group the rect (panel), with color lines (edges) or circles (for blind holes), whenever needed, in the part-input layer.

    While polylines (also with cut holes) and other geometric entities, were counted (using their BBox as rect), unfortunately, groups where not counted in the packing, they simply do not show in the final layout!

     

    I have studied the various nodes and found a solution that may be useful.

    The node modifies are in DrawParts -> Move

    and I have changed it as follows (just the commented parts):

     

    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    	this = Marionette.Node( 'Move' )
    	this.SetDescription("This node will move an object or point by an offset in 2D or 3D. If the object is planar this node does not move it outside of its plane.")
    	input = Marionette.PortIn( vs.Handle(0), 'in' )	 
    	input.SetDescription('An object, vector or point to move')
    	d = Marionette.PortIn( 0, 'offset') 
    	d.SetDescription('The distance to move the object. It could be a 2D/3D vector or Point2/Point3 in the Input category')		
    	output = Marionette.PortOut('out')	
    	output.SetDescription('The result')
    
    def RunNode(self):  
    	d = self.Params.d.value
    	i = self.Params.input.value		
    	if type(i) is tuple:
    		if len(i) == 3:
    			o = [0,0,0]
    			o[0] = i[0] + d[0]
    			o[1] = i[1] + d[1]
    			o[2] = i[2] + d[2]	
    		else:
    			o = [0,0]
    			o[0] = i[0] + d[0]
    			o[1] = i[1] + d[1]			
    		self.Params.output.value = tuple(o)		
    
    
    	else:		
    		planar = Marionette.Is2DObject(i)	
    		if not planar:
    			if len(d) == 2:
    				d = [d[0], d[1], 0]
    			vs.Move3DObj(i, d[0], d[1], d[2])
    
    		else:
    			vs.HMove(i, d[0], d[1])
    			
    			#this part allows the groups displaying correctly (planar objects only)
    			if vs.GetTypeN(i) == 11:
    				#read components in the group and duplicate them in the default container
    				h = vs.FInGroup(i)
    				while h != 0:
    					vs.CreateDuplicateObject(h, None)					
    					h = vs.NextObj(h)
    			#end of my added code
    			
    		self.Params.output.value = i	
    		

     

    It seems that the duplicated object (created in the node Dup in Container) is there, but if the handle is of type Group, it does not show.

    In my solution, I simply cycle inside the group components and duplicate them all in the default container (the plugin object).

    This allows to show the group content, but I do not know where the original group is hiding…

    Probably there is a better solution, I am not an expert of Marionette…

    Paolo

    • Like 1
×
×
  • Create New...