Ich hab mal das Editable Plus Script von Sandi Dolšak angepasst.
Damit werden alle selektierten Objekte (max 500) in einem Rutsch Vaterobjekt für Vaterobjekt zusammengefasst und auch noch optimiert.
Es konvertiert auch Nurbs Objekte mit Deckflächen und optimiert sie (was die eigentliche Aufgabe des Scripts war)
Wie immer, das Benutzen des Scrips geschieht auf eigene Gefahr.
Ciao ;-)
DoTheMagic(sel, doc) {
if(sel->GetType() == OBJECT_EXTRUDE || sel->GetType() == OBJECT_LOFT || sel->GetType() == OBJECT_SWEEP || sel->GetType() == OBJECT_LATHE) { // NURBs
CallCommand(12236); // Make Editable
CallCommand(100004768); // Select Children
CallCommand(16768); // Connect+Delete
} else if(sel->GetType() == OBJECT_SYMMETRY) { // Symmetry
CallCommand(12236); // Make Editable
sel = doc->GetActiveObject();
var name = sel->GetDown()->GetName();
CallCommand(100004768); // Select Children
CallCommand(16768); // Connect+Delete
sel = doc->GetActiveObject();
sel->SetName(name); // Sets the name. Remove if you like to keep the name of Symetry object
} else CallCommand(12236); // Make Editable
CallCommand(100004768); // Select Children
CallCommand(16768); // Connect+Delete
sel = doc->GetActiveObject();
var bc = new(BaseContainer);
if(!bc) return;
bc->SetData(MDATA_OPTIMIZE_TOLERANCE, 0.1);
bc->SetData(MDATA_OPTIMIZE_POINTS, TRUE);
bc->SetData(MDATA_OPTIMIZE_POLYGONS, TRUE);
bc->SetData(MDATA_OPTIMIZE_UNUSEDPOINTS, TRUE);
SendModelingCommand(MCOMMAND_OPTIMIZE, doc, sel, bc, MODIFY_ALL); // Optimize call
}
DeselectAll() {
var obj = object();
while(obj->SearchNext(BIT_AOBJ)) {
obj->ToggleBit(BIT_AOBJ);
obj = obj->SearchNext(BIT_AOBJ);
}
obj->ToggleBit(BIT_AOBJ);
}
main(doc, op) {
var i = 0;
var k = 0;
var selected = new(array, 500); // Increase this number if you will ever select more then 500 objects at once
var selSave = new(array, 500); // -||-
var obj = object();
if(!obj) return;
while(obj->SearchNext(BIT_AOBJ)) {
selected = obj;
i++;
obj = obj->SearchNext(BIT_AOBJ);
}
selected[i++] = obj;
DeselectAll();
var j;
for(j = 0; j < i; j++) {
selected[j]->ToggleBit(BIT_AOBJ);
DoTheMagic(selected[j], doc);
selSave[k] = doc->GetActiveObject();
k++;
doc->GetActiveObject()->ToggleBit(BIT_AOBJ);
}
for(j = 0; j <k; j++){
selSave[j]->ToggleBit(BIT_AOBJ);
}
}