@icse if the workplane from the featureset doesn't exist would this be a good way to use the world workplane instead?
if not entity_exists(entity('featureset','')) {
message info 'No active featureset'
return
}
bool $keepOriginal = 0
$keepOriginal = query 'Do you want to copy the active hole featureset?'
ENTITY $featureset = entity('featureset','')
string $newFSName = new_entity_name('featureset', $featureset.Name)
if $keepOriginal {
copy featureset ${featureset.Name}
// Activate the copied featureset
activate featureset ${newFSName}
$featureset = entity('featureset','')
}
string List $mirrorPlanes = {'YZ','XZ'}
int $plane = input Choice $mirrorPlanes 'Select mirror plane'
// Check if the workplane entity exists
bool $workplaneExists = entity_exists(entity('workplane', $featureset.Name))
if $workplaneExists {
ACTIVATE WORKPLANE FROMENTITY FEATURESET $featureset
} else {
// Activate a default workplane if the specified workplane does not exist
ACTIVATE WORKPLANE " "
}
EDIT FEATURESET ; DESELECT ALL
Graphics lock
if $plane == 0 {
foreach $feature in components($featureset) {
real $newValue = $feature.WPPoint[0] * -1 // X value
if not $workplaneExists {
// Apply the transformation using the world workplane
$newValue = $feature.Point[0] * -1 // X value using world workplane
}
EDIT FEATURESET $featureset SELECT $feature
EDIT FEATURESET ; FEATURE SELECT POSITION X $newValue
EDIT FEATURESET ; DESELECT ALL
}
} else {
foreach $feature in components($featureset) {
real $newValue = $feature.WPPoint[1] * -1 // Y value
if not $workplaneExists {
// Apply the transformation using the world workplane
$newValue = $feature.Point[1] * -1 // Y value using world workplane
}
EDIT FEATURESET $featureset SELECT $feature
EDIT FEATURESET ; FEATURE SELECT POSITION Y $newValue
EDIT FEATURESET ; DESELECT ALL
}
}
graphics unlock
// Add "mirror" to the end of the featureset name
$newFSName = $newFSName + " mirrored "
// Add the workplane used to mirror to the end of the featureset name
if $plane == 0 {
$newFSName = $newFSName + " in the X"
} else {
$newFSName = $newFSName + " in the Y"
}
// Rename the featureset with the new name
rename featureset ${featureset.Name} ${newFSName}
Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro