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: 

Macro getting Point of Featureset and make Pattern

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
gosmann.andreas
259 Views, 3 Replies

Macro getting Point of Featureset and make Pattern

Its working so far but if i turn a featureset after it was created it uses the centerpoint when it was made.

i could go with global workplane but than i have to pause the macro to select the correct plane xy or what it is after import the Model.

Is there a way to get the correct cordinates with wp.point?

 

BOOL $nope = false
FOREACH $feat IN $Gewindefsets {
	FOREACH $ft IN components($feat) {
		IF $ft.Description == $M10 {
			$nope = true
			BREAK
		}
		IF $ft.Description == $M12 {
			$nope = true
			BREAK
		}
	}
}
IF $nope == true {
	//Punkte für Muster raussuchen M10
STRING LIST pointsM10 = {}
STRING LIST pointsM12 = {}
FOREACH $feat IN $Gewindefsets {
	FOREACH $ft IN components($feat) {
		IF $ft.Description == $M10 {
			STRING pM10 = $ft.wppoint.x + ' ' + $ft.wppoint.y + ' ' + $ft.wppoint.z
			IF NOT member($pointsM10, $pM10) {
				INT k = add_last($pointsM10, $pM10)
			}
		}
		IF $ft.Description == $M12 {
			STRING pM12 = $ft.wppoint.x + ' ' + $ft.wppoint.y + ' ' + $ft.wppoint.z
			IF NOT member($pointsM12, $pM12) {
				INT g = add_last($pointsM12, $pM12)
			}
		}
	}
}


//Erstellen von Muster für Fase M10
IF NOT size($pointsM10) == 0 {
	STATUS EDITING_PLANE XY
	CREATE PATTERN ;
	EDIT PATTERN ; CURVEEDITOR NOGUI START
	CURVEEDITOR MODE CIRCLE 
	CURVEEDITOR CIRCLE RADIUS $FaseM10
FOREACH pM10 IN $pointsM10 {
	STRING mycmd = 'MODE COORDINPUT COORDINATES ' + $pM10
	DOCOMMAND $mycmd
}

CURVEEDITOR FINISH ACCEPT YES
3 REPLIES 3
Message 2 of 4

I made a video with autodesk screencast for understanding better what my problem is.

Perhaps someone have a solution for it.

Message 3 of 4

Interesting 🤔
It looks like that the Point is correctly inverted after the hole flip, but the WPPoint not and stay in the original coordinates.
In my opinion this is an Powermill bug and it is present even in the PM2025.

Here is an edited macro where are use myWpPoint[].

REAL $FaseM10 = "5"
STRING $M10 = "M10"
STRING $M12 = "M12"
//Featuresets wählen
ENTITY LIST Gewindefsets = INPUT ENTITY MULTIPLE featureset "Wähle alle Gewinde Featuresets die gefertigt werden sollen"
BOOL $nope = false
FOREACH $feat IN $Gewindefsets {
	FOREACH $ft IN components($feat) {
		IF $ft.Description == $M10 {
			$nope = true
			BREAK
		}
		IF $ft.Description == $M12 {
			$nope = true
			BREAK
		}
	}
}
IF $nope == true {
	//Punkte für Muster raussuchen M10 und M12
STRING LIST pointsM10 = {}
STRING LIST pointsM12 = {}
FOREACH $feat IN $Gewindefsets {
	FOREACH $ft IN components($feat) {
		REAL ARRAY myWpPoint[] = $ft.point
		IF error($workplane) == 0 {
			$myWpPoint = point_to_work(entity('Workplane',''), $ft.point)
		}
		IF $ft.Description == $M10 {
			STRING pM10 = $myWpPoint[0] + ' ' + $myWpPoint[1] + ' ' + $myWpPoint[2]
			IF NOT member($pointsM10, $pM10) {
				INT k = add_last($pointsM10, $pM10)
			}
		}
		IF $ft.Description == $M12 {
			STRING pM12 = $myWpPoint[0] + ' ' + $myWpPoint[1] + ' ' + $myWpPoint[2]
			IF NOT member($pointsM12, $pM12) {
				INT g = add_last($pointsM12, $pM12)
			}
		}
	}
}


//Erstellen von Muster für Fase M10
IF NOT size($pointsM10) == 0 {
	STATUS EDITING_PLANE XY
	CREATE PATTERN ;
	EDIT PATTERN ; CURVEEDITOR NOGUI START
	CURVEEDITOR MODE CIRCLE 
	CURVEEDITOR CIRCLE RADIUS $FaseM10
FOREACH pM10 IN $pointsM10 {
	STRING mycmd = 'MODE COORDINPUT COORDINATES ' + $pM10
	DOCOMMAND $mycmd
}
CURVEEDITOR FINISH ACCEPT YES

ondrejmikulec_0-1715847772134.png

 

Message 4 of 4

thank you for the solution 😍. I will send the video to autodesk support perhaps they will fix it.

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

Post to forums  

Technology Administrators