Jump to content

Raph

Member
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Raph

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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);
  6. @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
  7. 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
  8. 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
  9. 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
  10. 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
  11. Hi Letti, Thanks for your reply. unfortunately it doesn't work properly it seems that the created surfaces don't really get deleted Has anyone ever created a boolean node with an extra entry that would allow to act on the action of the boolean? Add, substrac or intersection Thanks in advance
  12. Hi Pat, Thank you for your answer. Unfortunately, this postpones the problem to the next step. The next node is a planar boolean. But an empty boolean operation also creates an error. Is it possible to create a planar boolean node with a configurable "add, sub, ..." input. Has anyone ever created a node like this?
  13. Hello everyone, I would like to change the state of a planar/solid boolean depending on a condition. More precisely, I would like to be able to remove or not a square to an existing volume. The condition is true or false. I thought I could do this with an "if" by acting on the size of the square. if true = 3mm if false = 0mm but it creates an error Does anyone have a solution for me? Thanks in advance greetings Raphael test Forum.vwx
  14. Hi everybody, OK I found a solution. I took a node that @DomC created and modified it see attached file Thank you for sharing your knowledge and helping me 😉 Now I would really like to learn how to make my own nodes so my question remains. Have you tips for learn to program in python for Vectorworks? Many thanks in advance
  15. Hi LEtti, Hi Dom, Hi everybody, Thank you for your answers. I wanted to change the text in the marionette node. But I have an error that appears. (see attached file) As a result, no changes are made. So I wanted to create a new marionette node. But I can't do it! Can you give me advice, tutorials or sources that show how I can create my own marionette nodes? Thanks in advance Raph
  16. Hi Letti Thanks for your reply. I have try and find a solution. Unfortunately now there are brackets, commas and apostrophes in the text. Example: dimension: [2000,'x',2500]mm Does anyone have a solution for me? Thanks in advance Parametric Symbol test v1.1.vwx
  17. hi everybody I would like to be able to display text from different sources and display them in the symbol in a row. example: Prefix = inner dimension: Variable 1= 2000 Variable 2 = x Variable 3= 2500 Sufix= mm Result inner dimension: 2000x2500mm Can someone help me to find a solution Parametric Symbol test v1.1.vwx
  18. Hi dom Thanks for your answers and your interest. first of all, did you update your "WorksheetInputExample_v2" file? Thanks for your advice, I installed deepnest and tried to import dxf. No dxf file opened. I tried with lines, surfaces, only the surface extractor. really weird. but it must be a good tool and very handy. it would be really nice if vector works would do the surface calculation directly. I am unfortunately not strong enough in python to do this. I will try again Thank you Dom ++
  19. Challenge Question I would like to cut out these 50 layers on the CNC. How would you do it? I tried to use your tool with these shapes but it doesn't work. I think they are not rectangles so it's impossible for the program to calculate that! the work is already done but I'd like to do a smaller one The idea would be to find an easier and faster method than the one I did. Because I took each layer one after the other to extract the surface and place it manually on a panel. Then I exported a cutting file for each panel with 3-5 shapes. What do you think about it? RAph WhatsApp Video 2021-08-07 at 16.09.56.mp4
  20. Ok 1) I work on Mac. It sure can make a difference but it used to work with the 2020. 2) I work with the separators in dot mode. 3) The version I use is in French. 4) I can't help you there, please give me more details on what you need to know. I'm not really sure I didn't modify the raw panel list and part list. But I'm sure it was working. I hope I can help you find the problem RAph
  21. Hi Dom, Thank you for your help! opening the file with version 2021 works. but when I launch the calculation vectorworks crashes. Raph WorksheetInputExample_v2.vwx
  22. Hi Dom, Thank you for your answer As you can imagine it works. Now I have a problem with the "worksheetInput_Example" file. I think it comes from the version of vectorworks 2021 !? Because I opened it with the 2020 version and it worked Can you look at what's going on? Thanks in advance
  23. Hallo DomC, Vielen Dank für dieses sehr nützliche Tool. Ich habe festgestellt, dass es ein Limit für die Anzahl der Ausfahrtsschilder gibt. Nach 20 Platten "boards_out" die Berechnung stoppt und der Rest wird ausgelassen Wissen Sie, wo ich die Anzahl der Ausgangsfelder im Code anpassen kann? Vielen Dank im Voraus Raphael
×
×
  • Create New...