public bool BargraphenElementePositionieren(string kammer, string dummy, string positioniert) { try { this.translateliste.Clear(); if (this.catBargraphendocument != null && this.catBargraphenPart != null && this.catKomponenteHybriedBody != null) { HybridBody hbKammer = null; HybridBody hbDummy = null; HybridBody hbPositioniert = null; HybridShapeTypeLib.HybridShapeAssemble hsAssemble = null; HybridShapeTypeLib.HybridShapeLinePtDir hsAusrichtung = null; HybridShapeTypeLib.HybridShapeLinePtDir hsRotAchse = null; // passende Kammer suchen //for (int b = 1; b <= this.catKomponenteHybriedBody.HybridBodies.Count; b++) //{ // object bindex = b; // if(this.catKomponenteHybriedBody.HybridBodies.Item(ref bindex).get_Name().ToLower() == kammer) // { // hbKammer = this.catKomponenteHybriedBody.HybridBodies.Item(ref bindex); // break; // } //} //if (hbKammer != null) //{ HybridShapeTypeLib.HybridShapeFactory hsFactory = (HybridShapeTypeLib.HybridShapeFactory)this.catBargraphenPart.HybridShapeFactory; // Translations setzen HybridShapeTypeLib.HybridShapeTranslate hsTranslate_1 = hsFactory.AddNewEmptyTranslate(); HybridShapeTypeLib.HybridShapeTranslate hsTranslate_2 = hsFactory.AddNewEmptyTranslate(); HybridShapeTypeLib.HybridShapeTranslate hsTranslate_3 = hsFactory.AddNewEmptyTranslate(); hbKammer = this.catKomponenteHybriedBody; #region - Dummy der Kammer, den Container, die Ausrichtung & die Rot-Achse filtern - for (int b = 1; b <= hbKammer.HybridBodies.Count; b++) { object bindex = b; if (hbKammer.HybridBodies.Item(ref bindex).get_Name().ToLower() == dummy) { hbDummy = hbKammer.HybridBodies.Item(ref bindex); for (int s = 1; s <= hbDummy.HybridShapes.Count; s++) { object sindex = s; if (hbDummy.HybridShapes.Item(ref sindex).get_Name().ToLower() == "container") { hsAssemble = (HybridShapeTypeLib.HybridShapeAssemble)hbDummy.HybridShapes.Item(ref sindex); } else if (hbDummy.HybridShapes.Item(ref sindex).get_Name().ToLower() == "ausrichtung") { hsAusrichtung = (HybridShapeTypeLib.HybridShapeLinePtDir)hbDummy.HybridShapes.Item(ref sindex); } else if (hbDummy.HybridShapes.Item(ref sindex).get_Name().ToLower() == "rot-achse") { hsRotAchse = (HybridShapeTypeLib.HybridShapeLinePtDir)hbDummy.HybridShapes.Item(ref sindex); } if (hsAssemble != null && hsAusrichtung != null && hsRotAchse != null) { break; } } } else if (hbKammer.HybridBodies.Item(ref bindex).get_Name().ToLower() == positioniert) { hbPositioniert = hbKammer.HybridBodies.Item(ref bindex); } if (hbDummy != null && hbPositioniert != null) { break; } } #endregion ------------------------------------------------------------------------- if (hsAssemble != null) { Reference refShapeAssemble = this.catBargraphenPart.CreateReferenceFromObject(hsAssemble); // erste Referenz bedienen hsTranslate_1.ElemToTranslate = refShapeAssemble; hsTranslate_1.VectorType = 1; // Rotations setzen HybridShapeTypeLib.HybridShapeRotate hsRotate = hsFactory.AddNewEmptyRotate(); Reference refStartpunkt = null; #region - Referenz des Startpunktes setzen - for (int i = 1; i <= this.catKomponenteHybriedBody.HybridShapes.Count; i++) { object index = i; if (this.catKomponenteHybriedBody.HybridShapes.Item(ref index).get_Name().ToLower() == "startpunkt") { HybridShapeTypeLib.HybridShapePointOnCurve pointoncurve = (HybridShapeTypeLib.HybridShapePointOnCurve)this.catKomponenteHybriedBody.HybridShapes.Item(ref index); refStartpunkt = this.catBargraphenPart.CreateReferenceFromObject(pointoncurve); break; } } #endregion --------------------------------- if (refStartpunkt != null) { hsTranslate_1.FirstPoint = refStartpunkt; //Body kammerbody = null; //#region - CloseSurface auf das erste Element setzen - //for (int b = 1; b <= this.catBargraphenPart.Bodies.Count; b++) //{ // object bindex = b; // if (this.catBargraphenPart.Bodies.Item(ref bindex).get_Name().ToLower() == kammer) // { // kammerbody = this.catBargraphenPart.Bodies.Item(ref bindex); // break; // } //} //#endregion ------------------------------------------ if (hbKammer != null) { this.catBargraphenPart.InWorkObject = hbKammer; try { this.catBargraphenPart.Update(); } catch { } ShapeFactory sfFormName = (PARTITF.ShapeFactory)this.catBargraphenPart.ShapeFactory; Reference refFormName = this.catBargraphenPart.CreateReferenceFromName(""); CloseSurface csFromName = sfFormName.AddNewCloseSurface(refFormName); csFromName.Surface = refShapeAssemble; try { this.catBargraphenPart.Update(); } catch { } if (this.punkteliste.Count > 0 && this.linienliste.Count > 0 && this.punkteliste.Count == this.linienliste.Count) { for (int l = 0; l < this.punkteliste.Count; l++) { // Translation des Elements setzen Reference refPunkt = this.catBargraphenPart.CreateReferenceFromObject(punkteliste[l]); hsTranslate_1.SecondPoint = refPunkt; hsTranslate_1.VolumeResult = false; try { this.catBargraphenPart.Update(); } catch { } // Translation der Kammer_Positioniert setzen hbPositioniert.AppendHybridShape(hsTranslate_1); try { this.catBargraphenPart.Update(); } catch { } #region - Translation der ersten Achsenlinie setzen - Reference refAchsenlinie1 = this.catBargraphenPart.CreateReferenceFromObject(hsAusrichtung); hsTranslate_2.ElemToTranslate = refAchsenlinie1; hsTranslate_2.VectorType = 1; hsTranslate_2.FirstPoint = refStartpunkt; hsTranslate_2.SecondPoint = refPunkt; hsTranslate_2.VolumeResult = false; hbPositioniert.AppendHybridShape(hsTranslate_2); try { this.catBargraphenPart.Update(); } catch { } #endregion #region - Translation der zweiten Achsenlinie setzen - Reference refAchsenlinie2 = this.catBargraphenPart.CreateReferenceFromObject(hsRotAchse); hsTranslate_3.ElemToTranslate = refAchsenlinie2; hsTranslate_3.VectorType = 1; hsTranslate_3.FirstPoint = refStartpunkt; hsTranslate_3.SecondPoint = refPunkt; hsTranslate_3.VolumeResult = false; hbPositioniert.AppendHybridShape(hsTranslate_3); try { this.catBargraphenPart.Update(); } catch { } #endregion #region - Rotation setzen ... #region ... Selektion auf das Element HybridShapeTypeLib.HybridShapeTranslate translationElement = null; for (int t = 1; t <= hbPositioniert.HybridShapes.Count; t++) { object tindex = t; if (hbPositioniert.HybridShapes.Item(ref tindex).get_Name().ToLower() == hsTranslate_1.get_Name().ToLower()) { translationElement = (HybridShapeTypeLib.HybridShapeTranslate)hbPositioniert.HybridShapes.Item(ref tindex); break; } } if (translationElement != null) { Reference refRotation = this.catBargraphenPart.CreateReferenceFromObject(translationElement); hsRotate.ElemToRotate = refRotation; hsRotate.VolumeResult = false; hsRotate.RotationType = 1; } #endregion #region ... Selektion auf die zweite Achse HybridShapeTypeLib.HybridShapeTranslate translationAchse_1 = null; for (int t = 1; t <= hbPositioniert.HybridShapes.Count; t++) { object tindex = t; if (hbPositioniert.HybridShapes.Item(ref tindex).get_Name().ToLower() == hsTranslate_3.get_Name().ToLower()) { translationAchse_1 = (HybridShapeTypeLib.HybridShapeTranslate)hbPositioniert.HybridShapes.Item(ref tindex); break; } } if (translationAchse_1 != null) { Reference refAchse = this.catBargraphenPart.CreateReferenceFromObject(translationAchse_1); hsRotate.Axis = refAchse; } #endregion #region ... Selektion auf die erste Achse HybridShapeTypeLib.HybridShapeTranslate translationAchse_2 = null; for (int t = 1; t <= hbPositioniert.HybridShapes.Count; t++) { object tindex = t; if (hbPositioniert.HybridShapes.Item(ref tindex).get_Name().ToLower() == hsTranslate_2.get_Name().ToLower()) { translationAchse_2 = (HybridShapeTypeLib.HybridShapeTranslate)hbPositioniert.HybridShapes.Item(ref tindex); break; } } if (translationAchse_2 != null) { Reference refAchse = this.catBargraphenPart.CreateReferenceFromObject(translationAchse_2); hsRotate.FirstElement = refAchse; } #endregion #region ... Element rotieren Reference refLinie = this.catBargraphenPart.CreateReferenceFromObject(linienliste[l]); hsRotate.SecondElement = refLinie; hsRotate.OrientationOfFirstElement = false; hsRotate.OrientationOfSecondElement = false; hbPositioniert.AppendHybridShape(hsRotate); try { this.catBargraphenPart.Update(); } catch { } #endregion #endregion ------------------ #region - Translationen ausblenden - ProductDocument dp = (ProductDocument)catApp.ActiveDocument; Selection auswahl_1 = dp.Selection; VisPropertySet visuelleEigenschaften = auswahl_1.VisProperties; auswahl_1.Add(hsTranslate_1); visuelleEigenschaften = (VisPropertySet)visuelleEigenschaften.Parent; visuelleEigenschaften.SetShow(CatVisPropertyShow.catVisPropertyNoShowAttr); auswahl_1.Clear(); #endregion ------------------------- #region - CloseSurface erzeugen - Reference refCS_1 = this.catBargraphenPart.CreateReferenceFromName(""); PARTITF.CloseSurface csFromName_2 = sfFormName.AddNewCloseSurface(refCS_1); Reference refRot = this.catBargraphenPart.CreateReferenceFromObject(hsRotate); csFromName_2.Surface = refRot; try { this.catBargraphenPart.Update(); } catch { } #endregion ---------------------- #region - neue leere Translation mit Referenz auf Startpunkt setzen - hsTranslate_1 = hsFactory.AddNewEmptyTranslate(); hsTranslate_2 = hsFactory.AddNewEmptyTranslate(); hsTranslate_3 = hsFactory.AddNewEmptyTranslate(); hsTranslate_1.ElemToTranslate = refShapeAssemble; hsTranslate_1.VectorType = 1; hsTranslate_1.FirstPoint = refStartpunkt; #endregion ---------------------------------------------------------- #region - neue leere Rotation setzen - hsRotate = hsFactory.AddNewEmptyRotate(); #endregion --------------------------- } } } else { // ToDo: passende Meldung return false; } } else { // ToDo: passende Meldung return false; } } else { // ToDo: passende Meldung return false; } //} //else //{ // // ToDo: passende Meldung // return false; //} } } catch (Exception ex) { CatLogging.catLogging.writeLogEintrag("Fehler beim Positionieren der Bargraphenelemente", ex, "CatBasic.BargraphenElementePositionieren()"); return false; } return true; }