I want to highlight some object on a layer, with another layer pushed in the background. I try now to make a clone form all entities and move them to layer one. Unfourtunatly this only works for polylines until now. I am not able to use "castToShap" for RTextEntities or block. Maybe someone has an hint:
Code: Select all
var appWin = EAction.getMainWindow();
appWin.handleUserMessage("Neubau mit Farbe hinterlegen")
var doc = this.getDocument();
var di = this.getDocumentInterface();
var op = new RAddObjectsOperation();
var ids = doc.queryAllEntities();
var ids_lays = doc.queryAllLayers();
var newItm;
var sh;
var itm;
for (var i=0; i<ids_lays.length; i++) {
var id_lay = ids_lays[i];
akt_layer = doc.queryLayer(id_lay);
if ( akt_layer.getName().indexOf("Neubau ...") != -1 ) { //nur Neubau Layer
var layer_entities =doc.queryLayerEntities(id_lay,true)
doc.setCurrentLayer("0")
var copied_entityee = layer_entities.clone()
for (var k=0; k<layer_entities.length; k++) {
appWin.handleUserMessage(akt_layer.getName())
var itm = doc.queryEntity(layer_entities[k]).clone();
if (isPolylineEntity(itm)) {
appWin.handleUserMessage("Polyline")
appWin.handleUserMessage(layer_entities[k].toString())
sh = itm.castToShape();
newItm = shapeToEntity(doc, sh.clone());
appWin.handleUserMessage(isEntity(newItm).toString());
op.addObject(newItm,false);
}else{
appWin.handleUserMessage("keine Polyline")
appWin.handleUserMessage(layer_entities[k].toString())
newItm = doc.queryEntity(layer_entities[k]).clone();
// newItm =shapeToEntity(newItm);
appWin.handleUserMessage(isEntity(newItm).toString())
op.addObject(newItm,false,true);
}
// appWin.handleUserMessage(newItm.toString())
di.applyOperation(op);
op = new RAddObjectsOperation();
}
}
}
appWin.handleUserMessage("sdf")