public static BCOM.LineElement getElementRangeBox(BCOM.Element el) { BCOM.View view = ViewHelper.getActiveView(); BCOM.Point3d[] verts = new BCOM.Point3d[16]; verts[0] = el.Range.Low; verts[1] = verts[0]; verts[1].X = el.Range.High.X; verts[2] = verts[1]; verts[2].Y = el.Range.High.Y; verts[3] = verts[2]; verts[3].X = el.Range.Low.X; verts[4] = verts[5] = verts[0]; verts[5].Z = el.Range.High.Z; verts[6] = verts[5]; verts[6].Y = el.Range.High.Y; verts[7] = verts[6]; verts[7].X = el.Range.High.X; verts[8] = verts[7]; verts[8].Y = el.Range.Low.Y; verts[9] = verts[5]; verts[10] = verts[6]; verts[11] = verts[3]; verts[12] = verts[2]; verts[13] = verts[7]; verts[14] = verts[8]; verts[15] = verts[1]; return(App.CreateLineElement1(null, verts)); }
/// Called by the state machine for each mouse move event. /// point: Current cursor location. /// view: Cursor is in this view. /// drawMode: Draw mode supplied by the drawing engine. public void Dynamics(ref Point3d Point, BCOM.View View, MsdDrawingMode DrawMode) { if (m_nPoints != 1) { return; } string[] txtStr = new string[2]; Point3d[] txtPts = new Point3d[2]; Element[] elems = new Element[3]; m_atPoints[1] = Point; txtStr[0] = (myForm.rbEN.Checked ? "E=" : "X=") + m_atPoints[0].X.ToString("F2"); txtStr[1] = (myForm.rbEN.Checked ? "N=" : "Y=") + m_atPoints[0].Y.ToString("F2"); double txtLen = app.ActiveSettings.TextStyle.Width * Math.Max(txtStr[0].Length, txtStr[1].Length); double txtLineSpacing = app.ActiveSettings.TextStyle.Height; if (myForm.rbHorizontal.Checked) { m_atPoints[2].X = m_atPoints[1].X + (m_atPoints[0].X > m_atPoints[1].X ? -txtLen : txtLen) * 1.2; m_atPoints[2].Y = m_atPoints[1].Y; txtPts[0].X = (m_atPoints[1].X + m_atPoints[2].X) / 2; txtPts[0].Y = m_atPoints[1].Y + txtLineSpacing; txtPts[1].X = txtPts[0].X; txtPts[1].Y = m_atPoints[1].Y - txtLineSpacing; } else { m_atPoints[2].X = m_atPoints[1].X; m_atPoints[2].Y = m_atPoints[1].Y + (m_atPoints[0].Y > m_atPoints[1].Y ? -txtLen : txtLen) * 1.2; txtPts[0].X = m_atPoints[1].X - txtLineSpacing; txtPts[0].Y = (m_atPoints[1].Y + m_atPoints[2].Y) / 2; txtPts[1].X = m_atPoints[1].X + txtLineSpacing; txtPts[1].Y = txtPts[0].Y; } elems[0] = app.CreateLineElement1(null, ref m_atPoints); elems[0].LineStyle = app.ActiveDesignFile.LineStyles.Find("0", null); Matrix3d rMatrix = app.Matrix3dIdentity(); for (int i = 1; i < 3; i++) { elems[i] = app.CreateTextElement1(null, txtStr[i - 1], ref txtPts[i - 1], ref rMatrix); elems[i].AsTextElement().TextStyle.Font = app.ActiveDesignFile.Fonts.Find(MsdFontType.MicroStation, "ENGINEERING", null); elems[i].AsTextElement().TextStyle.Justification = MsdTextJustification.CenterCenter; if (myForm.rbVertical.Checked) { elems[i].RotateAboutZ(ref txtPts[i - 1], Math.PI / 2); } } CellElement elemCell = app.CreateCellElement1("NoteCoordCell", ref elems, ref m_atPoints[0], false); elemCell.Redraw(DrawMode); if (MsdDrawingMode.Normal == DrawMode) { app.ActiveModelReference.AddElement(elemCell); } }
private void DgvFields_SelectionChanged(object sender, EventArgs e) { // выделить(подсветить) объект задания в модели для пользователя selectionTranContainer?.Reset(); foreach (DataGridViewRow row in dgvFields.SelectedRows) { PenetrTask task = (PenetrTask)dgvFields.Rows[row.Index].DataBoundItem; BCOM.ModelReference modelRef = Addin.App.MdlGetModelReferenceFromModelRefP((int)task.modelRefP); BCOM.View view = ViewHelper.getActiveView(); List <long> itemsIds = new List <long> { task.elemId }; // добавляем фланцы: foreach (PenetrTaskFlange flangeTask in task.FlangesGeom) { itemsIds.Add(flangeTask.elemId); } foreach (long id in itemsIds) { BCOM.Element el = modelRef.GetElementByID(id); el.Color = 2; // зелёный el.LineWeight = 5; // для ОТЛАДКИ ************************************************* //BCOM.Transform3d taskTran; //{ // BCOM.Point3d origin = (el as BCOM.CellElement).Origin; // var shift = Addin.App.Vector3dSubtractPoint3dPoint3d( // Addin.App.Point3dZero(), task.Location); // el.Move(Addin.App.Point3dFromXYZ(shift.X, shift.Y, shift.Z)); // taskTran = Addin.App.Transform3dInverse( // Addin.App.Transform3dFromMatrix3d(task.Rotation)); // el.Transform(taskTran); // el.Move(task.Location); //} //************************************************************** selectionTranContainer.AppendCopyOfElement(el); } view.Redraw(); } }
private void ensureLocateEnabled(ref BCOM.Point3d Point, BCOM.View View) { if (ensureLocateEnabledRequired_) { // ! unblock Locate ensureLocateEnabledRequired_ = false; app_.CommandState.StopDynamics(); app_.CommandState.LocateElement(ref Point, View, true); app_.CommandState.GetHitPath(); app_.CommandState.StartDynamics(); } }
/// User-supplied datapoint. /// point: Where the user clicked. /// view: User clicked in this view. public void DataPoint(ref Point3d Point, BCOM.View View) { if (m_nPoints == 0) { app.CommandState.StartDynamics(); m_atPoints[0] = Point; m_nPoints = 1; app.ShowPrompt("Identify note position"); } else { Dynamics(ref Point, View, MsdDrawingMode.Normal); Reset(); } }
public void DataPoint(ref BCOM.Point3d Point, BCOM.View View) { PenetrUserTask userTask; if (!processInput(out userTask, ref Point, View)) { return; } PenetrInfo penInfo = PenetrDataSource.Instance.getPenInfo( userTask.FlangesType, userTask.DiameterType.Number); ElementHelper.RunByRecovertingSettings(() => { PenetrHelper.addToModel(userTask, penInfo); }); }
public void changeSelection(IEnumerable <DataRow> selection) { selectionTranCon_?.Reset(); foreach (DataRow taskRow in selection) { PenetrVueTask task = rowsToTasks_[taskRow]; BCOM.ModelReference modelRef = task.ModelRef; BCOM.View view = ViewHelper.getActiveView(); var taskUOR = new UOR(task.ModelRef); var activeUOR = new UOR(App.ActiveModelReference); List <long> itemsIds = new List <long> { task.elemId }; // добавляем фланцы: foreach (PenetrTaskFlange flangeTask in task.FlangesGeom) { itemsIds.Add(flangeTask.elemId); } foreach (long id in itemsIds) { BCOM.Element temp = modelRef.GetElementByID(id).Clone(); temp.Color = 2; // зелёный temp.LineWeight = 5; #if CONNECT // для версии CONNECT требуется поправка // в V8i возмоно она производится автоматически BCOM.Attachment attachment = task.getAttachment(); if (attachment != null) { temp.Transform(attachment.GetReferenceToMasterTransform()); } #endif selectionTranCon_.AppendCopyOfElement(temp); } } }
public void Accept(Element Elem, ref Point3d Point, BCOM.View View) { Element newEl; Point3d orgPnt; double dScale = double.Parse(myForm.tbScale.Text); Point3d offsetPnt = app.Point3dFromXYZ(double.Parse(myForm.tbXOffset.Text), double.Parse(myForm.tbYOffset.Text), double.Parse(myForm.tbZOffset.Text)); for (int i = 0; i < int.Parse(myForm.tbCopies.Text); i++) { newEl = app.ActiveModelReference.CopyElement(Elem, null); newEl.Move(ref offsetPnt); orgPnt.X = (newEl.Range.Low.X + newEl.Range.High.X) * 0.5; orgPnt.Y = (newEl.Range.Low.Y + newEl.Range.High.Y) * 0.5; orgPnt.Z = (newEl.Range.Low.Z + newEl.Range.High.Z) * 0.5; newEl.ScaleAll(ref orgPnt, dScale, dScale, dScale); newEl.Redraw(MsdDrawingMode.Normal); Elem = newEl.Clone(); } }
public void Dynamics(ref BCOM.Point3d Point, BCOM.View View, BCOM.MsdDrawingMode DrawMode) { PenetrUserTask userTask; if (!processInput(out userTask, ref Point, View)) { return; } PenetrInfo penInfo = PenetrDataSource.Instance.getPenInfo( userTask.FlangesType, userTask.DiameterType.Number); var frameList = PenetrHelper.createFrameList( userTask, penInfo, PenetrTaskBase.LevelMain); var el = frameList.AsTFFrame.Get3DElement(); el.Redraw(DrawMode); }
public void Accept(BCOM.Element Element, ref BCOM.Point3d Point, BCOM.View View) { BCOM.Element oEle = Element; ECInstanceList oECInstancelist = Tag.oECAdaptor.ReadInstancesFromElement(oEle, false); foreach (ECInstance oEC in oECInstancelist) { if (oEC.ClassDefinition.Name == "Embankment" || oEC.ClassDefinition.Name == "RetainWall" || oEC.ClassDefinition.Name == "Pond" || oEC.ClassDefinition.Name == "Road" || oEC.ClassDefinition.Name == "OpenChannel" || oEC.ClassDefinition.Name == "Dike") { Commons.UpdateUIBasedOnFunctionCode(Tag.s_current, oEC.ClassDefinition.Name); Commons.PopulateGeoTagForm(Tag.s_current, oEC); //WS: select the element. AddInMain.ComApp.ActiveModelReference.SelectElement(oEle, true); AddInMain.ComApp.ShowCommand(""); AddInMain.ComApp.ShowPrompt("Old Tag Data Retrived."); break; } } }
public void DataPoint(ref BCOM.Point3d Point, BCOM.View View) { points_[pointIndex_++] = app_.Point3dFromXY(Point.X, Point.Y); if (pointIndex_ > 2) { // TODO в модель BCOM.Element leader = createLeader(); leader.ScaleUniform(leader.AsCellElement().Origin, 1 / ElementHelper.getActiveAnnotationScale()); // ! перед добавлением в модель mdlCell_setIsAnnotation((int)leader.MdlElementDescrP(), 1); //leader.AsCellElement().ScaleUniform(); app_.ActiveModelReference.AddElement(leader); var propHand = app_.CreatePropertyHandler(leader); propHand.GetAccessStrings(); propHand.SelectByAccessString("AnnotationPurpose"); if ((bool)propHand.GetValue()) { propHand.SelectByAccessString("IsAnnotation"); propHand.SetValue(true); } leader.Rewrite(); app_.ActiveModelReference.PropagateAnnotationScale(); //var res = mdlCell_setAnnotationScale(leader.MdlElementDescrP(), ElementHelper.getActiveAnnotationScale()); PenetrLocateCmd.StartCommand(); } }
public void Dynamics( ref BCOM.Point3d Point, BCOM.View View, BCOM.MsdDrawingMode DrawMode) { points_[pointIndex_] = Point; createLeader()?.Redraw(DrawMode); }
public void DataPoint(ref Point3d Point, Bentley.Interop.MicroStationDGN.View View) { Element column = null, foundation = null, foundation_rebars = null, column_longitudinal_rebars = null, column_stirrups = null; stirrupData = read_Data(); switch (stf.Type) { case TYPE.TYPE1: { StirrupData1 data = (StirrupData1)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.B, data.H, 1500, 1500, 1500, 400, 50, stf.Type, data.M, data.N); column_stirrups = StirrupUtil.create_column_stirrups(data.B, data.H, 1500, 400, stf.Type, data.M, data.N); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } case TYPE.TYPE2: { StirrupData2 data = (StirrupData2)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.B, data.H, 1500, 1500, 1500, 400, 50, stf.Type); column_stirrups = StirrupUtil.create_column_stirrups(data.B, data.H, 1500, 400, stf.Type); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } case TYPE.TYPE3: { StirrupData3 data = (StirrupData3)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.B, data.H, 1500, data.B1, data.H1, 1500, 1500, 400, 50, stf.Type); column_stirrups = StirrupUtil.create_column_stirrups(data.B, data.H, data.B1, data.H1, 1500, 400, stf.Type); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } case TYPE.TYPE4: { StirrupData4 data = (StirrupData4)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.B, data.H, 1500, 1500, 1500, 400, 50, stf.Type); column_stirrups = StirrupUtil.create_column_stirrups(data.B, data.H, 1500, 400, stf.Type); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } case TYPE.TYPE5: { StirrupData5 data = (StirrupData5)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.B, data.H, 1500, 1500, 1500, 400, 50, stf.Type, data.M, data.N); column_stirrups = StirrupUtil.create_column_stirrups(data.B, data.H, 1500, 400, stf.Type, data.M, data.N); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } case TYPE.TYPE6: { StirrupData6 data = (StirrupData6)stirrupData; column = RCUtil.create_column(data.D, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.D, 1500, 1500, 1500, 400, 50, stf.Type); column_stirrups = StirrupUtil.create_column_stirrups(data.D, 1500, 400, stf.Type); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } case TYPE.TYPE7: { StirrupData7 data = (StirrupData7)stirrupData; column = RCUtil.create_column(data.D, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); column_longitudinal_rebars = LongitudinalBarUtil.create_column_longitudinal_rebars(data.D, 1500, 1500, 1500, 400, 50, stf.Type); column_stirrups = StirrupUtil.create_column_stirrups(data.D, 1500, 400, stf.Type); foundation_rebars = FootingSlabBarUtil.create_foundation_rebars(1500, 1500, 400); break; } } TFPartRef tfpart_ref = TFPartUtil.create_tfpart_ref("Ceiling", "Metal"); TFPartUtil.add_part_to_element(ref column, tfpart_ref); TFPartUtil.add_part_to_element(ref foundation, tfpart_ref); TFPartUtil.add_part_to_element(ref column_longitudinal_rebars, tfpart_ref); TFPartUtil.add_part_to_element(ref column_stirrups, tfpart_ref); TFPartUtil.add_part_to_element(ref foundation_rebars, tfpart_ref); column.Move(ref Point); foundation.Move(ref Point); column_longitudinal_rebars.Move(ref Point); column_stirrups.Move(ref Point); foundation_rebars.Move(ref Point); List <Element> elements = new List <Element>(); elements.Add(column); elements.Add(foundation); elements.Add(column_longitudinal_rebars); elements.Add(column_stirrups); elements.Add(foundation_rebars); draw_Elements(elements.ToArray(), "diji"); }
public void Dynamics(ref Point3d Point, Bentley.Interop.MicroStationDGN.View View, MsdDrawingMode DrawMode) { Element column = null, foundation = null; stirrupData = read_Data(); switch (stf.Type) { case TYPE.TYPE1: { StirrupData1 data = (StirrupData1)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } case TYPE.TYPE2: { StirrupData2 data = (StirrupData2)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } case TYPE.TYPE3: { StirrupData3 data = (StirrupData3)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } case TYPE.TYPE4: { StirrupData4 data = (StirrupData4)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } case TYPE.TYPE5: { StirrupData5 data = (StirrupData5)stirrupData; column = RCUtil.create_column(data.B, data.H, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } case TYPE.TYPE6: { StirrupData6 data = (StirrupData6)stirrupData; column = RCUtil.create_column(data.D, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } case TYPE.TYPE7: { StirrupData7 data = (StirrupData7)stirrupData; column = RCUtil.create_column(data.D, 1500, 400); foundation = RCUtil.create_foundation(1500, 1500, 400); break; } } //动态移动的时候不显示配筋,只有点击的时候才画配筋 column.Move(ref Point); foundation.Move(ref Point); //必须redraw,否侧元素不显示 column.Redraw(DrawMode); foundation.Redraw(DrawMode); }
public void Dynamics( ref BCOM.Point3d Point, BCOM.View View, BCOM.MsdDrawingMode DrawMode) { }
private bool processInput(out PenetrUserTask userTask, ref BCOM.Point3d Point, BCOM.View View) { BCOM.Point3d point = Point; ensureLocateEnabled(ref point, View); userTask = singleModel_.UserTask; if (string.IsNullOrEmpty(userTask.Code)) { return(false); } BCOM.HitPath hitPath = App.CommandState.GetHitPath(); if (!userTask.IsManualRotateMode && hitPath != null) { BCOM.Element firstHitElem = hitPath.GetElementAt(1); //int type1 = (int)firstHitElem.Type; if (firstHitElem.IsPlanarElement()) { userTask.Rotation = App.Matrix3dFromRotationBetweenVectors( ZAxis, firstHitElem.AsPlanarElement().Normal); } else { // TODO обход по поверхностям var targetFaces = new List <TFCOM.TFBrepFace>(); TFCOM.TFBrepList brepList = AppTF.CreateTFBrep(); try { // может быть исключение brepList.InitFromElement(firstHitElem, App.ActiveModelReference); } catch (Exception) { } foreach (TFCOM.TFBrepFace faceList in brepList?.GetFacesEx()) { TFCOM.TFPlane tfPlane; if (faceList.IsPlanar(out tfPlane)) { //BCOM.ShapeElement shapeElement; //BCOM.Point3d[] verts; //faceList.AsTFBrepFace.GetVertexLocations(out verts); //BCOM.ShapeElement shape = App.CreateShapeElement1(null, verts); BCOM.Point3d closest; BCOM.Point3d normal; BCOM.Point2d param; // faceList.GetClosestPoint(out closest, out normal, out param, ref Point); tfPlane.GetNormal(out normal); if (faceList as TFCOM.TFBrepFaceListClass != null) { normal = App.Point3dNegate(normal); } userTask.Rotation = App.Matrix3dFromRotationBetweenVectors( ZAxis, normal); break; //if (closest.EqualsPoint(Point)) //{ // targetFaces.Add(faceList); //} } } ; } } if (userTask.IsAutoLength) { double thickness = 0.0; BCOM.Element locEl = app_.CommandState.LocateElement(ref Point, View, true); if (locEl != null && locEl.IsCellElement()) { TFCOM.TFElementList tfList = AppTF.CreateTFElement(); tfList.InitFromElement(locEl); int type = tfList.AsTFElement.GetApplicationType(); if (tfList.AsTFElement.GetIsFormType()) { TFCOM._TFFormRecipeList recipeList; tfList.AsTFElement.GetFormRecipeList(out recipeList); if (type == (int)TFFormTypeEnum.TF_SLAB_FORM_ELM) { var slab = (TFCOM.TFFormRecipeSlabList)recipeList; slab.AsTFFormRecipeSlab.GetThickness(out thickness); } else if (type == (int)TFFormTypeEnum.TF_LINEAR_FORM_ELM) { var wall = (TFCOM.TFFormRecipeLinearList)recipeList; wall.AsTFFormRecipeLinear.GetThickness(out thickness); } } } if (thickness > 0.0) { userTask.LengthCm = (int)Math.Ceiling(thickness) / 10; } else { userTask.LengthCm = 1; } } singleModel_.setLocation(point); // для обновления формы return(true); }
public void DataPoint(ref BCOM.Point3d Point, BCOM.View View) { //throw new NotImplementedException(); }
/// <summary> /// IPrimitiveCommandEvents DataPoint Method. /// </summary> /// <param name="point"></param> /// <param name="view"></param> public void DataPoint(ref BCOM.Point3d point, BCOM.View view) { }
public void Accept(BCOM.Element Element, ref BCOM.Point3d Point, BCOM.View View) { View.Redraw(); }
/// <summary> /// ILocateCommandEvents Accept method. /// </summary> /// <param name="element"></param> /// <param name="point"></param> /// <param name="view"></param> public void Accept(BCOM.Element element, ref BCOM.Point3d point, BCOM.View view) { }