Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with this macro

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
abner_asafe
661 Views, 10 Replies

Help with this macro

Hello, I need help with this macro, at the beginning I need it to show a list with the workplanes to select just one (commented part of the code) after that open the option to create a plane aligned in the geometry and then get the plane that I selected at the beginning and align its top view with the plane aligned in the geometry

 

//   STRING LIST $PlanoP = {}
//   $PlanoP = INPUT ENTITY MULTIPLE Workplane "Selecione o plano de trabalho principal" 
//   GRAPHICS LOCK
//   DIALOGS MESSAGE OFF
//  DIALOGS ERROR OFF
   

 ACTIVATE Workplane INCLINADO


MODE WORKPLANE_CREATE ; INTERACTIVE GEOMETRY
   Macro Pause "Clique na face que deseja alinhar a vista" 


ACTIVATE Workplane "1"
ROTATE TRANSFORM TOP


COPY WORKPLANE INCLINADO
RENAME Workplane "INCLINADO_1" "INCLINADO_X"
MODE WORKPLANE_EDIT START "INCLINADO_X"
MODE WORKPLANE_EDIT ALIGN VIEW
MODE WORKPLANE_EDIT FINISH ACCEPT

delete workplane"1"

 

10 REPLIES 10
Message 2 of 11
icse
in reply to: abner_asafe

you need a entity list insted of a string list:

 

entity LIST $PlanoP = {}
$PlanoP = INPUT ENTITY MULTIPLE Workplane "Selecione o plano de trabalho principal"

 

and for a single workplane use this:

entity $PlanoP = INPUT ENTITY Workplane "Selecione o plano de trabalho principal"

 

Message 3 of 11
abner_asafe
in reply to: abner_asafe


 

 

 

   entity LIST $PlanoP = {}
	entity $PlanoP = INPUT ENTITY Workplane "Selecione o plano de trabalho principal"
   GRAPHICS LOCK
   DIALOGS MESSAGE OFF
  DIALOGS ERROR OFF
 

 string $planoN= $PlanoP

 ACTIVATE Workplane $PlanoP


MODE WORKPLANE_CREATE ; INTERACTIVE GEOMETRY
   Macro Pause "Clique na face que deseja alinhar a vista" 


ACTIVATE Workplane "1"
ROTATE TRANSFORM TOP


COPY WORKPLANE $PlanoP
RENAME Workplane "$PlanoN" "INCLINADO_X"
MODE WORKPLANE_EDIT START "INCLINADO_X"
MODE WORKPLANE_EDIT ALIGN VIEW
MODE WORKPLANE_EDIT FINISH ACCEPT

delete workplane"1"

 

 

 

 

 


is this corret?

Message 4 of 11
icse
in reply to: abner_asafe

So you whant to change the rotation of the selected workplane with the rotation of the workplane the user created?

Message 5 of 11
abner_asafe
in reply to: icse

Yes exactly that

Message 6 of 11
icse
in reply to: abner_asafe

Try this:

entity $PlanoP = INPUT ENTITY Workplane "Selecione o plano de trabalho principal"

string $temp = new_entity_name('workplane','')
MODE WORKPLANE_CREATE ${temp} INTERACTIVE GEOMETRY


Macro Pause "Clique na face que deseja alinhar a vista" 

ACTIVATE Workplane ${temp}

entity $t = entity('workplane',$temp)


bool $sucsess = set_workplane($PlanoP, entity('workplane',$temp).YAxis,entity('workplane',$temp).ZAxis, $PlanoP.Origin ) 


ACTIVATE Workplane ${PlanoP.Name}

purge workplane ${temp} yes
Message 7 of 11
abner_asafe
in reply to: abner_asafe

works almost perfect i just need to create a copy of the initial selected workplane and aling this copy

 

Message 8 of 11
icse
in reply to: abner_asafe

im not able to test this atm but try this:

 

entity $PlanoP = INPUT ENTITY Workplane "Selecione o plano de trabalho principal"


string $PlanoN = 'INCLINADO_X'

if entity_exists('workplane',$PlanoN) {
	$PlanoN = new_entity_name('workplane',$PlanoN)
}

create workplane $PlanoN

string $temp = new_entity_name('workplane','')
MODE WORKPLANE_CREATE ${temp} INTERACTIVE GEOMETRY


Macro Pause "Clique na face que deseja alinhar a vista" 

ACTIVATE Workplane ${temp}

entity $t = entity('workplane',$temp)


bool $sucsess = set_workplane($PlanoN, entity('workplane',$temp).YAxis,entity('workplane',$temp).ZAxis, $PlanoN.Origin ) 


ACTIVATE Workplane ${PlanoN.Name}

purge workplane ${temp} yes

 

Message 9 of 11
abner_asafe
in reply to: abner_asafe

it's giving an error in the "bool $sucess" function line

Message 10 of 11
icse
in reply to: abner_asafe

entity $PlanoP = INPUT ENTITY Workplane "Selecione o plano de trabalho principal"


string $PlanoN = 'INCLINADO_X'

if entity_exists('workplane',$PlanoN) {
	$PlanoN = new_entity_name('workplane',$PlanoN)
}

create workplane $PlanoN

bool $s = 0
$s = set_workplane(entity('workplane',$PlanoN),$PlanoP)

string $temp = new_entity_name('workplane','')
MODE WORKPLANE_CREATE ${temp} INTERACTIVE GEOMETRY


Macro Pause "Clique na face que deseja alinhar a vista" 

ACTIVATE Workplane ${temp}

entity $t = entity('workplane',$temp)


$s = set_workplane(entity('workplane',$PlanoN), entity('workplane',$temp).YAxis,entity('workplane',$temp).ZAxis, entity('workplane',$PlanoN).Origin ) 


ACTIVATE Workplane ${PlanoN}

purge workplane ${temp} yes
Message 11 of 11
abner_asafe
in reply to: abner_asafe

Perfect thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report