Creating a hole feature set

This widget could not be displayed.

Creating a hole feature set

Anonymous
Not applicable

I have created a macro that creates hole feature set using the color from a model.

A problem with this macro is that if it doesn't encounter this color, it shows an error. These colors are pre-defined and hence I wish to use an if or a switch statement. How do I compare the RGB values and with what do I compare it to.

Is there a function that gives as output the RGB values of a hole?

Is there any better way to do it?

 

EDIT SELECTION MODEL CLEAR
EDIT SELECTION MODEL FILTER "250, 150, 150"

//CREATE HOLES

EDIT FEATURECREATE TYPE HOLE EDIT FEATURECREATE CIRCULAR ON EDIT FEATURECREATE FILTER HOLES EDIT FEATURECREATE TOPDEFINE ABSOLUTE EDIT FEATURECREATE BOTTOMDEFINE ABSOLUTE FORM CANCEL FEATURE FORM CREATEHOLE
EDIT FEATURECREATE HOLES FIXED ON
EDIT FEATURECREATE HOLES COMPOUND OFF
EDIT FEATURECREATE HOLES OPEN ON
EDIT FEATURECREATE MIN_ARC_ANGLE "60"
EDIT FEATURECREATE CREATEHOLES
FORM CANCEL CREATEHOLE

//RENAMING FEATURE SET 1 TO " "

 

 

 

0 Likes
Reply
440 Views
3 Replies
Replies (3)

rafael.sansao
Advisor
Advisor

Hello,

You can verify that after the color selection command, some color has actually been found in the model.

 

 

EDIT MODEL ALL DESELECT ALL
EDIT SELECTION MODEL CLEAR
EDIT SELECTION MODEL FILTER "250, 150, 150"

INT $Count = 0
FOREACH $Mod IN FOLDER('model') {
    $Count =  $Count + number_selected($entity('model',$Mod.name).components)
}
IF $Count == 0 {
	MESSAGE ERROR "No surface selected!"
	MACRO ABORT ALL
}

 

Rafael Sansão

EESignature

Anonymous
Not applicable

I don't want it to terminate the current macro. I want it to move on to recognizing the next color.

Thanks

0 Likes

rafael.sansao
Advisor
Advisor
EDIT MODEL ALL DESELECT ALL
EDIT SELECTION MODEL CLEAR
EDIT SELECTION MODEL FILTER "250, 150, 150"

INT $Count = 0
FOREACH $Mod IN FOLDER('model') {
    $Count =  $Count + number_selected($entity('model',$Mod.name).components)
}
IF $Count > 0 {
	//CREATE HOLES
	EDIT FEATURECREATE TYPE HOLE EDIT FEATURECREATE CIRCULAR ON EDIT FEATURECREATE FILTER HOLES EDIT FEATURECREATE TOPDEFINE ABSOLUTE EDIT FEATURECREATE BOTTOMDEFINE ABSOLUTE FORM CANCEL FEATURE FORM CREATEHOLE
	EDIT FEATURECREATE HOLES FIXED ON
	EDIT FEATURECREATE HOLES COMPOUND OFF
	EDIT FEATURECREATE HOLES OPEN ON
	EDIT FEATURECREATE MIN_ARC_ANGLE "60"
	EDIT FEATURECREATE CREATEHOLES
	FORM CANCEL CREATEHOLE
}

Rafael Sansão

EESignature

0 Likes