Is it possible to use a macro to create a workplane that has its location defined by the standard pick points (orange, yellow, green), and work for different block sizes? The pickpoints seem to be defined by their absolute location not location relative to the block.
The workplane location wouldn't have to be at the pick points, as long as the location was always relative to the outer dimensions of the block.
When viewing the command window during picking points is shows the following line:
[_PICK_21068_\r]
does anyone know what the number relates to, it changes for each point but seems a bit random.
Any help with this would be appreciated.
Thank you
Solved! Go to Solution.
Solved by rafael.sansao. Go to Solution.
You can do the calculation and transform the workplane. Here is an example:
REAL $X = $Block.Limits.Xmin + (($Block.Limits.Xmax - $Block.Limits.Xmin) / 2) REAL $Y = $Block.Limits.Ymin + (($Block.Limits.Ymax - $Block.Limits.Ymin) / 2) REAL $Z = $Block.Limits.Zmax CREATE WORKPLANE ; EDITOR MODE COORDINPUT COORDINATES $X $Y $Z MODE WORKPLANE_EDIT FINISH ACCEPT ACTIVATE WORKPLANE #
Rafael Sansão
Yes, there are commands to pick the coloured blobs whilst you're in the mode:
MODE WORKPLANE_CREATE ; INTERACTIVE BLOCK MODE WORKPLANE_CREATE BLOCK XMIN YMID ZMAX
Obviously, the command takes an X, Y and Z value, and for each a MIN, MID or MAX modifier.
I hope that helps.
Hi Raphael,
I have a couple of questions......
When I try to create a second WP with different values i get several errors "local variable already defined: x" y, z, .
any tips for getting past this? seems like i would need to define a new variable but not sure how to label them.
Also when I try to rename the WP
EXPLORER SELECT Workplane "Workplane\1" NEW RENAME Workplane "1" "TOP MID"
it only works if I paste it into the command line as a separate function, rather then adding it to the other code.
This is one of my first experiments with writing macros, so that's probably half the problem!
You can create the Workplane with the correct name. It is not necessary to rename.
For the second workplane, you can not declare the variables again.
Check out the example:
// First Workplane REAL $X = $Block.Limits.Xmin + (($Block.Limits.Xmax - $Block.Limits.Xmin) / 2) REAL $Y = $Block.Limits.Ymin + (($Block.Limits.Ymax - $Block.Limits.Ymin) / 2) REAL $Z = $Block.Limits.Zmax CREATE WORKPLANE "TOP MID" EDITOR MODE COORDINPUT COORDINATES $X $Y $Z MODE WORKPLANE_EDIT FINISH ACCEPT ACTIVATE WORKPLANE # // Second Workplane $X = $Block.Limits.Xmin + (($Block.Limits.Xmax - $Block.Limits.Xmin) / 2) $Y = $Block.Limits.Ymin + (($Block.Limits.Ymax - $Block.Limits.Ymin) / 2) $Z = $Block.Limits.Zmin CREATE WORKPLANE "BOTTON MID" EDITOR MODE COORDINPUT COORDINATES $X $Y $Z MODE WORKPLANE_EDIT FINISH ACCEPT ACTIVATE WORKPLANE #
Rafael Sansão
Thanks again for your help Raphael,
I have to remove this line:
ACTIVATE WORKPLANE #
then it to work as anticipated otherwise the second WP seems to be calculated from the previous WP?
Raphael,
This is working really well for me, I was able to have the WP change location relative to block size, and also added some code to orientate the WP. This is a great platform for me to expand upon. I'm planning to add some additional clearance WP's for transitional movements between toolpaths.
Thanks for helping us!
I've attached my macro for reference.
Very good. Congratulations on your work.
If your question has been answered, mark the answer as "accepted solution"
Rafael Sansão
Can't find what you're looking for? Ask the community or share your knowledge.