Jump to content

Raph

Member
  • Posts

    28
  • Joined

  • Last visited

Reputation

10 Good

Personal Information

  • Homepage
    standconcept.ch
  • Location
    Switzerland

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Pat, Hi Everybody, Here is the last parametric symbol that generates a worksheet Thanks Pat for your help As usual, if anyone has any suggestions for improvements, we'd love to hear from you greetings Raph TileRects_Symbol_WS.vwx
  2. Thanks for your quick feedback My idea was to create it with vs.python code Pat an idea? create a table in VS? 😁
  3. Hello, I would still like to export a "worksheet" list of the panels with the number and the dimension. Does anyone have an idea on the functions to use to make this happen? Thanks in advance greetings Raph
  4. Hello, OK I finished my program🤩 See attached file!!! Thank you Pat for your very valuable help I remain open to any possible improvement Greetings to all TileRects_Symbol.vwx
  5. Hello, Well.... I have made good progress I'm just blocked to finish the Y loop by changing the parameter "max" in "min" the loop runs without end, I think since VW crashes. Does anyone have an idea? Pat? I know that Python is not your favorite field but you have more experience than me😉 I tried to put a "if" SheetEndX > FX2 Do SheetEndX = FX2 but nothing works!!! file and printscreen attached Kind regards TileRectsFloor_v5.vwx
  6. Hi Pat, Thanks for your answers and your time It was very helpful. I think I'm not too far from success. missing me 1-2 hour Attached is a picture of my Marionette network. It gives an idea of what I want to be able to set up. I have adapted the code a bit as I thought My code below: # November 11, 2022 # ©2022 Patrick Stanford pat@coviana.com # Licensed under the GNU Lesser General Public License # No Warranty Expressed of Implied. Use at your own risk. # Very limited testing. # Tiles a rectangular area with a set of rectangles # the beginning of each row is the "cutoff" from the # end of the row above. # Modified by Raph_N November 17, 2022 # added two parameters: # 1. a deduction in the remaining panel of the thickness of the blade (ThBl:4mm) # 2. a minimum dimension at the end of a line that allows to decide if the line starts with a new panel (WmaxSold:200mm) @Marionette.NodeDefinition class Params(metaclass=Marionette.OrderedClass): # APPEARANCE # Name this = Marionette.Node("TileRects_OSB") this.SetDescription( 'This node performs a tiles a rectangular area with a set of rectangles the beginning of each row is the "cutoff" from the end of the row above.') # Input Ports in0 = Marionette.PortIn(vs.Handle(0), 'hObj1') in0.SetDescription('A list of objects to be operated on (blanks)') inWf = Marionette.PortIn(1, 'n_Wfloor') inWf.SetDescription('A dimension of the width (Pannels)') inHf = Marionette.PortIn(1, 'n_Hfloor') inHf.SetDescription('A dimension of the height (Pannels)') inWp = Marionette.PortIn(1, 'n_Wpan') inWp.SetDescription('A dimension of the width (Pannels)') inHp = Marionette.PortIn(1, 'n_Hpan') inHp.SetDescription('A dimension of the height (Pannels)') inThBl = Marionette.PortIn(1, 'nBlade') inThBl.SetDescription('A dimension with a thickness of a (Blade)') # Output Ports out = Marionette.PortOut('hObj') out.SetDescription('The resulting objects') # BEHAVIOR # this.SetLinksObjects() # this.SetListAbsorb() def RunNode(self): # inputs FX2 = self.Params.inWf.value FY2 = self.Params.inHf.value W1 = self.Params.inWp.value H1 = self.Params.inHp.value ThBl = self.Params.inThBl.value # script in0 = vs.FSActLayer() if in0 is not None: FX1 = 0 FY1 = 0 CurrentX = FX1 CurrentY = FY1 SheetEndX = FX1 + W1 SheetEndY = FY1 + H1 RemainderX = 0 RemainderY = 0 NP = 1 NProw = ((FX2-FX1)/W1) WmaxSold = ((FX2-FX1)-(NProw*W1)) Done = False NewLine = False vs.Rect(FX1, FY1, FX2, FY2) while not Done: RemainderX2 = W1 - WmaxSold NProw = vs.Trunc(((FX2 - FX1) - (W1 - WmaxSold)) / W1) WmaxSold = ((FX2 - FX1) - (NProw * W1) - RemainderX2) while SheetEndX <= FX2: if NP != 1 and WmaxSold<200: RemainderX = 0 NewLine = True else: Number = ((CurrentY - H1), FY2) ThisY = max(Number) vs.Rect(CurrentX, CurrentY, CurrentX + W1, ThisY) CurrentX = CurrentX + W1 SheetEndX = CurrentX + W1 NP = NP + 1 RemainderX = W1 - (FX2 - CurrentX) - ThBl vs.Rect(CurrentX, CurrentY, FX2, ThisY) if SheetEndX != FX2 and SheetEndY != FY2: if NewLine == True: CurrentX = FX1 + W1 NewLine = False NProw = Trunc((FX2 - FX1) / W1) WmaxSold = ((FX2 - FX1) - (NProw * W1)) else: CurrentX = FX1 + RemainderX Number = ((CurrentY - H1), FY2) CurrentY = max(Number) CurrentX = FX1 + RemainderX SheetEndY = max(Number) vs.Rect(FX1, CurrentY, CurrentX, SheetEndY) SheetEndX = CurrentX + W1 NP = NP + 1 else: Done = True # outputs TileRectsFloor_v2.vwx
  7. Hi Pat, No, it's not easy... but very interesting and formative. Can I really ask you the questions that come to me during this process? I begin with the first one, you say: "Go to the Plug-in Manager and create a new Rectangle Object. You will by default get two parameters, LineLength and BoxWidth. These will automatically change when you reshape the "rectangle" of the object. Use them to draw the outline of the room." ok i have make that, but I have a blank file with no text in it! Is this normal? see image in attached file Thank you for your wishes (welcome) Regards Raph
  8. Hi Pat, Thanks for your reply, i unterstand your preferences and the reasons that push you to continue on VS. Is it possible to link VS code with Marionette? Or is it only possible with Python? My basic idea was to create a parametric symbol (Marionette) where you just have to change the input variables (Floor dimensions and Panel dimensions) to recalculate the tile distribution. So now I try to write it in Python. You wrote: "If you are familiar with Python, it is fairly easy to convert the VS code into Python." No, it's not... I've done VBA instead. So the declaration of variables I also like a lot 😉 With python I tried to add two values and it tells me it's impossible because one time it's an 'int' and another is in 'list'??? grrr Thank you for your suggestion, I have corrected the post directly Kind regards Raph
  9. Hello, I would like to be able to write my code in python with Marionette to develop my Vectorworks tools. Only I find it difficult to write them in an IDE (PyCharm) which does not necessarily know all the elements of VW and to copy it in the script editor of VW to test, make modifications and copy it in the IDE again. Do you have any advice for writing? How do you do it? Is it possible to import the Marionette settings into an IDE? Attached is a picture of my desktop with my windows open. Thank you for your answers my greetings to the whole community
  10. Hello, I made some changes 1. a deduction in the remaining panel of the thickness of the blade (ThBl:4mm) 2. a minimum dimension at the end of a line that allows to decide if the line starts with a new panel (WmaxSold:200mm) Procedure TileRects; {November 11, 2022} {©2022 Patrick Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {No Warranty Expressed of Implied. Use at your own risk.} {Very limited testing.} {Tiles a rectangular area with a set of rectangles} {the beginning of each row is the "cutoff" from the} {end of the row above.} {Modified by Raph_N November 17, 2022} {added two parameters: 1. a deduction in the remaining panel of the thickness of the blade (ThBl:4mm) 2. a minimum dimension at the end of a line that allows to decide if the line starts with a new panel (WmaxSold:200mm).} VAR X1,X2,Y1,Y2 :Real; FX1,FX2,FY1,FY2 :Real; {Floor Dims} RX1,RX2,RY1,RY2 :Real; {Rect Dims} ThBl :Real; {Thikness of the blade Dims} Hd1 :Handle; W1, H1 :Real; {panel width and height} NP :Integer; {number of full panels in Total} NProw :Integer; {number of full panels in row} Extra :Real; CurrentX, CurrentY :Real; SheetEndX, SheetEndY :Real; RemainderX, RemainderY :Real; RemainderX2 :Real; ThisY :Real; WmaxSold :Real; {maximum weight of the sold} Done :Boolean; NewLine :Boolean; BEGIN PtDialog('Enter the size of panel', '2500mm', '675mm', W1, H1); Hd1:=FSActLayer; If Hd1 <> Nil THEN BEGIN GetBBox(Hd1, FX1, FY1, FX2, FY2); CurrentX:=FX1; CurrentY:=FY1; SheetEndX:=FX1+W1; SheetEndY:=FY1-H1; ThBl:=4; RemainderX:=0; RemainderY:=0; NP:=1; NProw:= Trunc((FX2-FX1)/W1); WmaxSold:= ((FX2-FX1)-(NProw*W1)); Done:=False; SetDSelect(Hd1); WHILE Not Done DO BEGIN RemainderX2:=W1-WmaxSold; NProw:= Trunc(((FX2-FX1)-(W1-WmaxSold))/W1); WmaxSold:= ((FX2-FX1)-(NProw*W1)-RemainderX2); While SheetEndX <= FX2 DO BEGIN If ((NP <> 1) and (WmaxSold<200)) then BEGIN RemainderX:=0; NewLine:=True; END ELSE ; ThisY := Max(CurrentY-H1, FY2); Rect(CurrentX, CurrentY, CurrentX + W1, ThisY); CurrentX:=CurrentX + W1; SheetEndX:=CurrentX + W1; NP:=NP+1; End; RemainderX:=W1-(FX2-CurrentX)-ThBl; Rect(CurrentX, CurrentY, FX2, Max(CurrentY - H1,FY2)); If ((SheetEndX <> FX2) and (SheetEndY <> FY2)) then Begin If (NewLine = true) then BEGIN CurrentX:=FX1+W1; NewLine:=False; NProw:= Trunc((FX2-FX1)/W1); WmaxSold:= ((FX2-FX1)-(NProw*W1)); END ELSE CurrentX:=FX1+RemainderX; CurrentY:=Max(CurrentY-H1, FY2); SheetEndY:=Max(CurrentY-H1,FY2); Rect(FX1,CurrentY,CurrentX,SheetEndY); SheetEndX:=CurrentX+W1; NP:=NP+1; END Else Done:=True; End; End; End; Run(TileRects);
  11. @Pat Stanford Hi Pat, just a question.... why didn't you make the program in python language? Are there points that are easier to code with VectorScript or just out of habit? Well... that's 2 questions sorry Thanks in advance for your reply
  12. Hi Pat, Thanks for this program, it works very well. I have already adapted with an additional condition that removes 4mm from the remaining panels. This is to deduct the thickness of the blade. I am now working on putting an additional condition that will make it so that if the panel at the end of the line is smaller than X (200mm) it will start the row with a whole panel. thanks you very much for your help your base allows me to move forward Raph
  13. Hello to all, I have a new request for you... I would like to create a small program (parametric symbol) to calculate the need for panels on a floor. The principle is quite simple because it is enough to add panels in a row. However they must cross each other in order to be more stable and to use the remains. I enclose a picture to illustrate the problem. If someone has already done it or has an idea of the tools I can use I'm listening... 😉 Greetings Raph GraphiqueCollé-1.pdf
  14. Hi Letti, Thanks a lot for your complements and for the planar boolean node! Your code works well and I also adapted it for a solid boolean. So I tried the following two variations: 1. to put a "delete" after the rectangle 2. to put the planar boolean node with parameters in fact both solutions created the same problems. I realized that my approach was wrong. Instead of working with a boolean node for each element to be subtracted/added, I need a boolean node and send only the shapes that need to be subtracted. Sorry Letti, I didn't understand where the error came from. attached is a printscreen of the working solution (with a single boolean planar node)😉 Best regards Raph
  15. Hi everyone, I'm thinking about something like this... but I don't know enough python to do it by myself yet @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( "Planar Boolean" ) this.SetDescription('This node performs a boolean operation between lists of objects. The operation will be performed for each possible combination of objects in the lists supplied.') #Input Ports in0 = Marionette.PortIn( vs.Handle(0), 'hBlank' ) in0.SetDescription('A list of objects to be operated on (blanks)') in1 = Marionette.PortIn( vs.Handle(0), 'hTool') in1.SetDescription('A list of objects to operate on "in0" with (tools)') in2 = Marionette.PortIn(vsHandle(0), 'hValue') in2.SetDescription('A list of operation _ 0=Add _ 1=Substract _ 2=Intersect') #OIP Controls op = Marionette.OIPControl( 'operation', Marionette.WidgetType.Popup, 0, ['Add', 'Subtract', 'Intersect']) op.SetDescription('The operation to perform between objects\n' ' Add: equivalent to the "Add Surface" command in VW\n' ' Subtract: equivalent to the "Subtract Surface" command in VW\n' ' Intersect: equivalent to the "Intersect Surface" command in VW') #Output Ports out = Marionette.PortOut('hObj') out.SetDescription('The resulting objects') #BEHAVIOR this.SetLinksObjects() this.SetListAbsorb() def RunNode(self): #inputs in0 = self.Params.in0.value in1 = self.Params.in1.value in2 = self.Params.in2.value #script output = [] if type(in0) != list: in0 = [in0] for blank in in0: if blank != vs.Handle(0): if type(self.Params.in1.value) != list: in1 = [in1] for tool in in1: newObj = vs.Handle(0) if tool != vs.Handle(0): #Add if self.Params.op.value == 0: newObj = vs.AddSurface(blank, tool) # blank and tool will be deleted after this operation if newObj != vs.Handle(0) and newObj != None and newObj != tool: blank = newObj #Subtract elif self.Params.op.value == 1: newObj = vs.ClipSurfaceN(blank, tool) # blank and tool won't be deleted after this operation if newObj != vs.Handle(0) and newObj != None and newObj != tool: vs.Marionette_DisposeObj(blank) vs.Marionette_DisposeObj(tool) blank = newObj #Intersect elif self.Params.op.value == 2: newObj = vs.IntersectSurface(blank, tool) # blank and tool won't be removed after this opeartion if newObj != vs.Handle(0) and newObj != None and newObj != tool: vs.Marionette_DisposeObj(blank) vs.Marionette_DisposeObj(tool) blank = newObj while blank != vs.Handle(0): if self.Params.op.value in [1, 2]: if blank != tool: output.append(blank) else: output.append(blank) blank = vs.NextObj(blank) #outputs self.Params.out.value = output
×
×
  • Create New...