How to get the workplane information by using API or macro in C#

How to get the workplane information by using API or macro in C#

peter.hsiao
Contributor Contributor
715 Views
1 Reply
Message 1 of 2

How to get the workplane information by using API or macro in C#

peter.hsiao
Contributor
Contributor

Hello guys~ 


My project has two workplanes
name: 1 (active)

name: Eletcro_Workplane

I  want to get the distance of Z direction of these workplanes, so i right click on workplane Eletcro_Workplane, and click  properties.

Afterward, I find the answer  in Relative to Active Workplane > Position > Z. (like picture Eletcro_Workplane_Properties.JPG)
But i can't find the method how to use API to get this information in C# 

I have tried to find the method using powermill.ActiveProject.Workplanes , but find nothing 😞 

Could anyone help me  >~< 

0 Likes
716 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

This is part of a larger code project I had for moving Work Planes around, but the language will get you you the relative numbers from one WP to another - just ignore the edit move section in my code - lol.

 

string list $names = extract(folder('workplane'),'name')

ACTIVATE Workplane "1"

REAL ARRAY workplanePosition[3] = $Workplane.Origin

FOREACH workpl in $names {
MODE WORKPLANE_EDIT START $workpl
MODE WORKPLANE_EDIT POSITION
MODE POSITION WORKSPACE WORKPLANE
MODE POSITION CARTESIAN X $workplanePosition[0]
MODE POSITION CARTESIAN Y $workplanePosition[1]
MODE POSITION CARTESIAN Z $workplanePosition[2]
POSITION APPLY
MODE WORKPLANE_EDIT FINISH ACCEPT
}

0 Likes