Reverse Selected Holes Macro

Reverse Selected Holes Macro

jelrod
Advocate Advocate
748 Views
8 Replies
Message 1 of 9

Reverse Selected Holes Macro

jelrod
Advocate
Advocate

I am trying to create a macro that will reverse the direction of all holes in a selected solid or just selected holes.  I've got it selecting all holes through the feature manager and that works correctly but am hung up on getting it to flip the plane details. After selection I have this:

 

TreeEdit
PLANE_DETAILS
FLIP
ACCEPT
APPLY

 

It seems to do nothing.  It's probably something easy and obvious to someone more versed in macros than me. Thanks for any help with this.

0 Likes
749 Views
8 Replies
Replies (8)
Message 2 of 9

Yogesh.Mohite
Alumni
Alumni

Hi @jelrod,

 

Thank you for contacting Autodesk Community Forum.

 

As per information available with me there is limitation that user can not select an edge in PS GUI using macro command. There is an existing change request for ability to select an edge using PowerShape macro and development team is working on this change request.

 

Hope above given information helps.

 


Yogesh Mohite
0 Likes
Message 3 of 9

jelrod
Advocate
Advocate

Below was my first attempt for reversing all holes in a selected solid.  If I select a solid  and run this it selects all of the holes, in graphics looks like it reverses them, and completes.  Even though it looks like it reverses them it doesn't.

 

Since reversing the plane for the holes doesn't seem to be able to happen using multi select manually I assume I need to list all holes and loop through the list reversing individually but I'm not sure how to do that.

 

I would like to end up with a macro that would reverse all holes in a selected solid and one that would reverse only the preselected holes.

 

 TreeEdit
  Modify FeatureManager
  SELECTITEM TYPE Hole
  ACCEPT

TreeEdit
Modify Feature Draw
PLANE_DETAILS
FLIP
ACCEPT
APPLY
RENAME_ON
CANCEL

0 Likes
Message 4 of 9

Sudhira
Autodesk Support
Autodesk Support

@jelrod wrote:

Below was my first attempt for reversing all holes in a selected solid.  If I select a solid  and run this it selects all of the holes, in graphics looks like it reverses them, and completes.  Even though it looks like it reverses them it doesn't.

 

Since reversing the plane for the holes doesn't seem to be able to happen using multi select manually I assume I need to list all holes and loop through the list reversing individually but I'm not sure how to do that.

 

I would like to end up with a macro that would reverse all holes in a selected solid and one that would reverse only the preselected holes.

 

 TreeEdit
  Modify FeatureManager
  SELECTITEM TYPE Hole
  ACCEPT

TreeEdit
Modify Feature Draw
PLANE_DETAILS
FLIP
ACCEPT
APPLY
RENAME_ON
CANCEL


 

Hi Jelrod,

 

Thanks for posting in Autodesk Community!!!

 

As I understood, you are stuck with some issue to create Hole macro as well as reverse the holes of the solid. For better clarification of your query,  you have to put more effort to create a video file by using screencast tool by click on below link.

 

https://knowledge.autodesk.com/community/screencast

 

It could be better if you can upload the PSMODEL. Please provide this on earliest, then only I will try my best to provide you the right solution. Look forward to hearing from you.

 


Thanks,
Sudhira Dora
0 Likes
Message 5 of 9

jelrod
Advocate
Advocate

Thanks @Sudhira

 

Here is a screencast best showing what I want to do.  It shows how I can reverse the hole direction when only selecting one hole but that option is not available if I select more than one hole.  What I am wanting is a macro that lets me multi select holes and will reverse those selected holes when ran. I have also tried reversing all holes in a selected solid but I really only need for it to work on my preselected holes.

 

I had hoped it would be as simple as the previous posted code but suspect that it needs a loop reversing holes individually instead of all at once.  I've also tried the following code attempting that but I can't get it to work either.

 

TreeEdit
  Modify FeatureManager
  SELECTITEM TYPE Hole
  ACCEPT
 
LET num_holes = Selection.number
IF $num_holes == 0 {
  PRINT 'Nothing selected - select holes and features'
  RETURN
}
 

 
LIST hol_names = SELECTION.NAMES
 
LET i = 1
LET carry_on = ($i <= $num_holes)
WHILE $carry_on {
  STRING hol_name = $hol_names[$i]

add hole $hol_name
 TreeEdit

 
  TreeEdit
Modify Feature Draw
PLANE_DETAILS
FLIP
ACCEPT
APPLY
RENAME_ON
CANCEL

 
  LET i = $i + 1
  LET carry_on = ($i <= $num_holes)

 

 

 

 

Screencast will be displayed here after you click Post.

66952e5a-9ece-4e0f-acb7-297e6e67c727

 

0 Likes
Message 6 of 9

jelrod
Advocate
Advocate

 

 

 

0 Likes
Message 7 of 9

jelrod
Advocate
Advocate

@Sudhira

 

Attached is a psmodel with 4 holes.  Two are one direction and two are the other. I want to be able to pre-select two of them and have a macro to reverse them.

 

This is a simple model but when a model has 40 or 50 holes that needs reversing it takes a while doing them individually and is why I am trying to make a macro

0 Likes
Message 8 of 9

Sudhira
Autodesk Support
Autodesk Support

@@jelro wrote:

@Sudhira

 

Attached is a psmodel with 4 holes.  Two are one direction and two are the other. I want to be able to pre-select two of them and have a macro to reverse them.

 

This is a simple model but when a model has 40 or 50 holes that needs reversing it takes a while doing them individually and is why I am trying to make a macro


 

Hi Jelrod,

 

There is no option in filter to select the hole feature. So there is an alternative option for this. Please refer the video to resolve the issue in another way. But we can wish for this option in the future release. In the future, I will get any better idea, definitely share with you. 

 

 

 

 


Thanks,
Sudhira Dora
0 Likes
Message 9 of 9

jelrod
Advocate
Advocate

Thanks @Sudhira for the workaround.  Mirroring that way works when a part is symmetric but won't when it's not or when the geometry has an offset.  It will however work on some parts and I will use this method when applicable.

 

I had hoped a macro could reverse hole planes but maybe it can't. It does work if you add the name of the hole before the code that flips the plane so my thought was if I could collect the selected hole names they could be looped through in the macro flipping the planes.  Maybe it's just not possible.  Thank you for the effort.

 

 

 

0 Likes