Faster way to edit hole features in macro?

Faster way to edit hole features in macro?

bfaberBB7MX
Contributor Contributor
688 Views
5 Replies
Message 1 of 6

Faster way to edit hole features in macro?

bfaberBB7MX
Contributor
Contributor

I'm currently working on a macro that fixes holes by combining stacked components of a hole that are the same diameter, but when iterating though all of the separated hole features and selecting the specific component that needs to be edited it slows down quite a bit when there is 500+ components.

the snippet of code that I am using for this is below.

 

EDIT FEATURESET $HFN select $firstfeature
EDIT FEATURESET ; FEATURE SELECTED COMPONENT SELECTED DEPTH $combineddepth
EDIT FEATURESET ; DESELECT ALL

 

I feel like I'm missing a way to edit a depth of a hole feature component without having to select it first.

 

thanks.

0 Likes
689 Views
5 Replies
Replies (5)
Message 2 of 6

ondrej.mikulec
Advocate
Advocate

Hello,
I did some tests and it looks like the select action of the component is really needed. But maybe someone has more information about this problem and I'm curious how to change the parameters of the holes as efficiently as possible. My test macro crashes on the line '$com.Depth = 5'

FOREACH $com IN components($entity('featureset','')) {
	PRINT $com.Depth
	//Crash here:
	$com.Depth = 5
}



A solution could be to export the feature set as an xml file, make changes to that file, and then import it into Powermill. But that might require more advanced programming, and I personally wouldn't do it via a macro, but with more advanced automation.

Message 3 of 6

bfaberBB7MX
Contributor
Contributor
Yep that was going to be my next step. Iv been meaning to get into some more advanced automation outside of powermill and this might be the project that pushes me into it.
0 Likes
Message 4 of 6

ondrej.mikulec
Advocate
Advocate

Yeah, in my opinion, automation outside of Powermill is a must for drilling operations. For me, it was one of the most satisfying jobs I've done. Using C# and actually using object-oriented programming to define holes, tools, operations, etc.

Message 5 of 6

bhanleyRM6VF
Enthusiast
Enthusiast

@ondrej.mikulec,

 

I have a similar case where I would like to resize holes by diameter, something like this:

 

FOREACH tk IN FOLDER('Featureset'){
FOREACH $com IN components($entity('featureset',$tk.name)) {
EXPLORER SELECT FEATURE $com NEW
//4-40
IF $component.Upperdia == .089 {
EDIT FEATURESET; FEATURE SELECTED COMPONENT SELECTED UPPERDIA "0.112"
}
//5-40
IF $component.Upperdia == .1015 {
EDIT FEATURESET; FEATURE SELECTED COMPONENT SELECTED UPPERDIA "0.125"
}

}
}

 

Is this doable?

0 Likes
Message 6 of 6

bhanleyRM6VF
Enthusiast
Enthusiast

^got this to work:

 

FOREACH $f IN FOLDER('Featureset') {
ACTIVATE Featureset $f
EDIT FEATURESET; DESELECT ALL
FOREACH $feat IN components($entity('featureset','')) {
EDIT FEATURESET; DESELECT ALL
EDIT FEATURESET ; SELECT $feat.name
REAL $dia = $feat.Diameter
//4-40
IF $dia == .089 {
EDIT FEATURESET; FEATURE SELECTED COMPONENT SELECTED UPPERDIA "0.112"
}
//5-40
IF $dia == .102 {
EDIT FEATURESET; FEATURE SELECTED COMPONENT SELECTED UPPERDIA "0.125"
}
}
}

0 Likes