Need a help. Create one or more Boundary. If more than one , combine them together.

Need a help. Create one or more Boundary. If more than one , combine them together.

peterquRXR7S
Advocate Advocate
665 Views
8 Replies
Message 1 of 9

Need a help. Create one or more Boundary. If more than one , combine them together.

peterquRXR7S
Advocate
Advocate

The macro I made doesn't work. Also, I don't know how to combine that two Boundary together. Because I don't know the Boundary name.

 

 

//-------------------------------------

ROTATE TRANSFORM TOP
DELETE SCALE

ACTIVATE FEATURESET ; FORM EDITHOLE
EDIT FEATURESET ; FEATURE SELECTION 0
REAL $R0=$widget("EditHole.Shell.Geom.UpperDia").value
$R0=$R0*0.5

 

FOREACH f IN components(entity('featureset','')) {
EDIT FEATURESET ; DESELECT ALL
EDIT FEATURESET # SELECT $f.name

//X,Y,Z
real $X=$widget("EditHole.Shell.Geom.PosFrame.X").value
real $Y=$widget("EditHole.Shell.Geom.PosFrame.Y").value
real $Z=$widget("EditHole.Shell.Geom.PosFrame.Z").value
FORM CANCEL EDITHOLE


CREATE BOUNDARY ; SKETCH FORM BOUNDARY
EDIT BOUNDARY ; PRIVATE NO
EDIT BOUNDARY ; AUTOREPLAY NO
EDIT BOUNDARY ; CURVEEDITOR START
CURVEEDITOR MODE CIRCLE
CURVEEDITOR CIRCLE RADIUS $R0
MODE COORDINPUT COORDINATES $X $Y $Z

}

//COMBINE THEM TOGETHER

EDIT Boundary $first_one INSERT Boundary $second_one

 

//I don't know how to get the Boundary name

 

peterquRXR7S_0-1696536576016.png

 

 

0 Likes
Accepted solutions (2)
666 Views
8 Replies
Replies (8)
Message 2 of 9

icse
Collaborator
Collaborator

So you whant to draw a circle for each hole of the active featureset in one boundary? Thats pretty easy i can write you a macro for that when im back at my work. 

0 Likes
Message 3 of 9

icse
Collaborator
Collaborator
Accepted solution

does this work for you?

if not entity_exists(entity('featureset','')) or size(components(entity('featureset',''))) == 0 {
	return
}
entity $fs = entity('featureset','')
ACTIVATE WORKPLANE FROMENTITY FEATURESET ${fs.Name}
string $boundaryName = $fs.Name
if entity_exists('boundary',$boundaryName) {
	$boundaryName = new_entity_Name('boundary',$boundaryName)
}

CREATE BOUNDARY ${boundaryName}
EDIT BOUNDARY ${boundaryName} PRIVATE NO
EDIT BOUNDARY ${boundaryName} AUTOREPLAY NO
EDIT BOUNDARY ${boundaryName} CURVEEDITOR START
CURVEEDITOR MODE CIRCLE

foreach $f in components($fs) {
	
	CURVEEDITOR CIRCLE RADIUS ${f.Diameter / 2}
	MODE COORDINPUT COORDINATES $f.WPPoint[0] $f.WPPoint[1] $f.WPPoint[2]
}
CURVEEDITOR FINISH accept
Message 4 of 9

peterquRXR7S
Advocate
Advocate

Thank you so much!  Your macro is professional. There is one small issue, the position is not right. I guess you use world coordinate. 

 

peterquRXR7S_0-1696589326212.png

 

0 Likes
Message 5 of 9

peterquRXR7S
Advocate
Advocate

peterquRXR7S_0-1696596590630.png

I use current work plane and your program works fine. Thank you!

0 Likes
Message 6 of 9

icse
Collaborator
Collaborator

It actually uses the workplane of the active featurest:

 

 

ACTIVATE WORKPLANE FROMENTITY FEATURESET ${fs.Name}

 

 

you can change it to whatever workplane you whant just by replaceing this line,

 

this uses the workplane of the active toolpath:

 

activate workplane ${entity('toolpath','').Workplane.Name}

 

 

this activates the worplane with the name 'myWorkplane'

 

activate workplane 'myWorkplane'

 

if you delete this line it just takes the active workplane

 

Message 7 of 9

peterquRXR7S
Advocate
Advocate

Thank you!

Another question. How can I get the diameter and position of one specific feature, Say the first hole.

 

  Something likes this,


CURVEEDITOR CIRCLE RADIUS ${CLEARANCE-THRU-.500-DIA-.697-ORING-CUP_D1_1.Diameter / 2}
MODE COORDINPUT COORDINATES $CLEARANCE-THRU-.500-DIA-.697-ORING-CUP_D1_1.WPPoint[0] $CLEARANCE-THRU-.500-DIA-.697-ORING-CUP_D1_1.WPPoint[1] $CLEARANCE-THRU-.500-DIA-.697-ORING-CUP_D1_1.WPPoint[2]

 

 

peterquRXR7S_0-1698326090932.png

 

 

 

0 Likes
Message 8 of 9

icse
Collaborator
Collaborator
Accepted solution

this gives you the diameter of the first hole in the active featureset:

real $dia = components(entity('featureset',''))[0].Diameter

this gives you the x y z coordinates:

 

real $x= components(entity('featureset',''))[0].WPPoint[0]
real $y= components(entity('featureset',''))[0].WPPoint[1]
real $z= components(entity('featureset',''))[0].WPPoint[2]
Message 9 of 9

peterquRXR7S
Advocate
Advocate

Thank you so much!

0 Likes