Hi!
Corpus 6.2.100.205
I made a makro added to the front and to give raster 32 holes on the sides as long as the height of the front..but I have a problem and I can’t solve it
when one of the sides is above the bottom,the holes move higher than the side that is at the same level with the bottom
How do I identify the elements in the macro, or what would be the solution?
thanks!
I hope it is understood in the video what I mean
Try this. Do not use Connect inside Joint. Use JX, JY, JZ to detect Obj2.
JX, JY, JZ is the location of a point inside Object2 measured from 0,0,0 of Obj1.
Once you have defined what Obj2 is, you can make holes on, for example, side 2 or 3 of Obj2.
(You can make holes on sides 4 and 5 once you know what Obj2 is.)
When calculating, you can say: If Obj2.y < Obj1.y then…
Then make another Macro for the right side.
Let’s say you want to find a point 30mm from the top of the front on the sides of the element.
GY for the left Obj2 would be…
GY = (obj1.aabb.ymax – obj2.y) – 30
and for
GY for the right Obj2 would be…
GY = (obj1.aabb.ymax – obj2.y) – 30
I didn’t test this. Just presenting the logic I would use
[VARIJABLE]
LEFT_SIDE_PERF=1
RIGHT_SIDE_PERF=1
Perforations_Depth=12
Perforations_Diameter=5
[FORMULE]
//evar=catuta variabila din parent to parent
front=parent.obj1.y
fund=obj2.y
AdSe=parent.Tandem_BMotion.depth
B_Jos=front-fund+parent.Tandem_BMotion.y+36
B_Sus=evar.Up_Distance
Front_Dist=37
Nr_G_32=round((v-B_Jos-B_Sus)/32+0.5)
Lungime_perforata=Nr_G_32*32
only_vert_sides=if(obj2.smjer=0;1;0)
Vert_gap=ydelta
gap_x=x
[JOINT]
JX=0
JY=front
JZ=-10
//********************** Left ************************************
[RASTER1]
J=1
GB=if((obj2.x<=x) and (LEFT_SIDE_PERF=1);Nr_G_32;0)*only_vert_sides
GN=******** Perforatii 32 in Fata *********
GD=Perforations_Depth
GF=Perforations_Diameter
GX=Front_Dist
GY=B_Jos
GS=1
GK=0
GP=0
GR=32
[RASTER2]
J=1
GB=if((obj2.x<=x) and (LEFT_SIDE_PERF=1);Nr_G_32;0)*only_vert_sides
GN=******** Perforatii 32 in Centru *********
GD=Perforations_Depth
GF=Perforations_Diameter
GX=if(AdSe=250;Front_Dist+160;if(AdSe=270;Front_Dist+160;if(AdSe=300;Front_Dist+224;if(AdSe=350;Front_Dist+224;if(AdSe=400;Front_Dist+192;if(AdSe=450;Front_Dist+224;if(AdSe=500;Front_Dist+224;if(AdSe=550;Front_Dist+224;if(AdSe=600;Front_Dist+224;0)))))))))
GY=B_Jos
GS=1
GK=0
GP=0
GR=32
No, you have to write two rasters for two passes.
By the way, I noticed one IF that is too long and hard to follow and maintain. There is a simpler way to write multiple IFs.
1. Instead of GX=If(AdSe=250;Front_Dist… write
GX=X_pos
(X_pos is a variable, you can give it another name)
2. In the [FORMULA] section write
X_pos=if(AdSe=250;Front_Dist+160;XP2)
XP2=if(AdSe=270;Front_Dist+160;XP3)
XP3=if(AdSe=300;Front_Dist+224;XP4)
XP4=if(AdSe=350;Front_Dist+224;XP5)
XP5=if(AdSe=400;Front_Dist+192;XP6)
XP6=if(AdSe=450;Front_Dist+224;XP7)
XP7=if(AdSe=500;Front_Dist+224;XP8)
XP8=if(AdSe=550;Front_Dist+224;XP9)
XP9=if(AdSe=600;Front_Dist+224;0)
Edit:
I seem to have misunderstood the problem. The solution I described at the bottom is for a simple grid on the sides of the cabinet when placing shelves.
If drawers are used, then the macro should be placed on the bottom of the drawer (for example), and the holes on both sides will be aligned
[JOINT]
CONNECT=23
mindistance=0
maxdistance=40
In this case, the hole positions will be calculated relative to the position of the drawer bottom. The position and angle of the sides are completely irrelevant.
I will leave a solution for a similar problem if it is necessary to do a grid on the horizontals of the cabinet.
If a regular grid is used on the sides of the cabinet when placing shelves, the Y drilling position should be set to count from the element origin.
For this it is enough to use the Y position of the board. For example, if the first object is drilled, and the position of the first hole is 200m from the element origin, then the GY parameter will be:
GY=-obj1.y+200
“-obj1.y” will move the start of the measurement to the Y origin.
If the second object is drilled then the position will be:
GY=-obj2.y+200
Of course, instead of the number 200, a predefined variable can be used.
In that case, the macro will look like this:
[VARIABLES]
FirstPoint=200
HoleQuantity=20
HoleDeep=10
HoleDiameter=10
HoleXpos=50
Raster=32
HoleDistance=350
[RASTER1]
J=0
GB=HoleQuantity
GN=HoleRaster
GD=HoleDeep
GF=HoleDiameter
GX=HoleXpos
GY=-obj1.y+FirstPoint
GS=0
GK=0
GP=0
GR=Raster
[RASTER2]
J=0
GB=HoleQuantity
GN=HoleRaster
GD=HoleDeep
GF=HoleDiameter
GX=HoleXpos+HoleDistance
GY=-obj1.y+FirstPoint
GS=0
GK=0
GP=0
GR=Raster
I solved it with 2 macros,thank you very much I appreciate your help
I have put a link to a short video below.
https://streamable.com/v6palq
can you share code with us? are you using obj1 obj2 parameters? overlap?
I have attached the cabinet with the macro added to the front..please check the link below to download the element
thanks
https://file.io/wxZCtZqQkNFA
I’m working in C5 and can not see cmk since it is encrypted from Corpus v6…
take look at this post, maybe this will tell you how to detect what board is behind front board and then apply two cmk files (one for left, one for right)
https://shop.redcat.hr/Pitanja/aventos-busenja-tockanja/?v=adab7b701f23
I have attached 2 files, a body version 5 and a separate makro
https://file.io/Yi7i5NFleWoL.
I used 2 macros for each side..can I do “jx” in a single macro to drill both side holes?
https://streamable.com/vw6u2y