public void Test() { //try //{ // Stopwatch sw = new Stopwatch(); // sw.Start(); // StringBuilder sb = new StringBuilder(); // foreach (var pile in Piles) // { // PileLengthCalculation pilecalculation = new PileLengthCalculation(pile, 2000); // sb.Append(pile.PileCode + "," + Utilities.CellingWithInterval(pilecalculation.GetPileLengthByBearingCapacity(),0.5) + "\n"); // } // sw.Stop(); // File.WriteAllText(@"D:\Result.csv", sb.ToString()); // MessageBox.Show(sw.Elapsed.TotalSeconds.ToString()); // //MessageBox.Show(sb.ToString()); //} //catch (Exception e) //{ // MessageBox.Show(e.ToString()); //} BCOM.Application app = Program.COM_App; BCOM.Point3d o = app.Point3dZero(); BCOM.Matrix3d m = app.Matrix3dIdentity(); var text = app.CreateTextElement1(null, "text", ref o, ref m); BCOM.TextStyle ts = app.ActiveSettings.TextStyle; ts.Color = 2; text.let_TextStyle(ts); app.ActiveModelReference.AddElement(text); }
/// <summary> /// Initializes the AddIn Called by the AddIn loader after /// it has created the instance of this AddIn class /// </remarks> /// <param name="commandLine"></param> /// <returns>0 on success</returns> protected override int Run(string[] commandLine) { MSApp = BMI.Utilities.ComApp; // Register reload and unload events, and show the form ReloadEvent += new ReloadEventHandler(NetworkDesigner_ReloadEvent); UnloadedEvent += new UnloadedEventHandler(NetworkDesigner_UnloadedEvent); return(0); }
/// <summary>The AddIn loader creates an instance of a class /// derived from Bentley.MicroStation.AddIn and invokes Run. /// </summary> protected override int Run ( System.String[] commandLine ) { s_comApp = BMI.Utilities.ComApp; return(0); }
/// <summary> /// Initializes the AddIn Called by the AddIn loader after /// it has created the instance of this AddIn class /// </remarks> /// <param name="commandLine"></param> /// <returns>0 on success</returns> protected override int Run(string[] commandLine) { MSApp = BMI.Utilities.ComApp; MessageBox.Show("进入 csAddins_xml ! fullname: " + MSApp.FullName); // Register reload and unload events, and show the form ReloadEvent += new ReloadEventHandler(PowerCivilAddin1_ReloadEvent); UnloadedEvent += new UnloadedEventHandler(PowerCivilAddin1_UnloadedEvent); return(0); }
/*-----------------------------------------------------------------------------*/ /// <summary>The AddIn loader creates an instance of a class /// derived from Bentley.MicroStation.AddIn and invokes Run. /// </summary> /// <param name="commandLine">arguments sent in with the mdl load command /// </param> /*-----------------------------------------------------------------------------*/ protected override int Run(System.String[] commandLine) { s_comApp = BMI.Utilities.ComApp; s_bIsOPM = (s_comApp.Name.CompareTo("OpenPlantModeler") == 0 || s_comApp.Name.CompareTo("BRCM") == 0); s_bIsUSTN = (s_comApp.Name.CompareTo("ustation") == 0 || s_comApp.Name.CompareTo("AECOsimBuildingDesigner") == 0); s_comApp.CadInputQueue.SendKeyin("mdl load wpahelper"); s_whiteList = new List <string>(); string whiteList = ""; //check to see if there is a white list of acceptable schema. This is stored //in the config file. There is a command to build the list. if (s_comApp.ActiveWorkspace.IsConfigurationVariableDefined("BV_SCHEMA_WHITELIST")) { whiteList = s_comApp.ActiveWorkspace.ConfigurationVariableValue("BV_SCHEMA_WHITELIST", true); } string[] values; if (whiteList.Length > 0) { values = whiteList.Split(':'); foreach (string value in values) { s_whiteList.Add(value); } } s_runningTraverse = false; //this.ElementChangedEvent += new ElementChangedEventHandler(BVSchemaElementEventHandler); //native code write to file hooks. //this looks for the write to file options //and for the input queue int bSilent = 0; if (s_comApp.ActiveWorkspace.IsConfigurationVariableDefined("BV_SCHEMACHECKER_SILENT")) { bSilent = int.Parse(s_comApp.ActiveWorkspace.ConfigurationVariableValue("BV_SCHEMACHECKER_SILENT", false)); } //this replaces the call to just turn on the hook. so we only have one //path through this operation. should possibly use a cfg var at some point. TurnOnWriteHook(true); //mdlWriteToFileHook(bSilent); //this sets the on close the var must be defined and have a value of 1 to set the close hook if (s_comApp.ActiveWorkspace.IsConfigurationVariableDefined("BV_SCHEMACHECKER_ONCLOSE") && 1 == int.Parse(s_comApp.ActiveWorkspace.ConfigurationVariableValue("BV_SCHEMACHECKER_ONCLOSE", false))) { Events.SetEventHandlers(); } return(0); }
public static void ToolSettings(string unparsed) { BCOM.Application app = Utilities.ComApp; if (app.ActiveModelReference.Is3D) { MessageBox.Show("This tool can only work in 2D model"); return; } app.ActiveSettings.AnnotationScaleEnabled = false; app.CommandState.StartPrimitive(new NoteCoordClass(), false); }
public static BCOM.Plane3d GetPlane3dYZ(this BCOM.Application app) { if (planeYZ_ == null) { planeYZ_ = new BCOM.Plane3d() { Origin = App.Point3dZero(), Normal = app.Point3dFromXYZ(1, 0, 0) }; } return(planeYZ_.Value); }
/// <summary>The AddIn loader creates an instance of a class /// derived from Bentley.MicroStation.AddIn and invokes Run. /// </summary> protected override int Run(System.String[] commandLine) { s_comApp = BMI.Utilities.ComApp; // Register reload and unload events, and show the form this.ReloadEvent += new ReloadEventHandler(AddInMain_ReloadEvent); this.UnloadedEvent += new UnloadedEventHandler(AddInMain_UnloadedEvent); GSFStiffenerControl.ShowForm(this); return(0); }
/// <summary> /// Initializes the AddIn Called by the AddIn loader after /// it has created the instance of this AddIn class /// </remarks> /// <param name="commandLine"></param> /// <returns>0 on success</returns> protected override int Run(string[] commandLine) { MSApp = Bentley.MicroStation.InteropServices.Utilities.ComApp; // MessageBox.Show("进入 ProgramTest! fullname: " + MSApp.FullName); CreateElement.LineAndLineString(null); // MessageBox.Show(@"运行完成"); // Register reload and unload events, and show the form ReloadEvent += new ReloadEventHandler(PowerCivilAddin1_ReloadEvent); UnloadedEvent += new UnloadedEventHandler(PowerCivilAddin1_UnloadedEvent); return 0; }
public static void TestDimsionElement() { BCOM.Application app = Program.COM_App; var m = app.Matrix3dIdentity(); var dim = app.CreateDimensionElement1(null, ref m, Bentley.Interop.MicroStationDGN.MsdDimType.AngleLocation); var p0 = app.Point3dFromXY(100, 100); var p1 = app.Point3dFromXY(000, 0); var p2 = app.Point3dFromXY(0, 100); dim.AddReferencePoint(app.ActiveModelReference, ref p0); dim.AddReferencePoint(app.ActiveModelReference, ref p1); dim.AddReferencePoint(app.ActiveModelReference, ref p2); app.ActiveModelReference.AddElement(dim); }
/// <summary> /// Initializes the AddIn Called by the AddIn loader after /// it has created the instance of this AddIn class /// </remarks> /// <param name="commandLine"></param> /// <returns>0 on success</returns> protected override int Run(string[] commandLine) { MSApp = BMI.Utilities.ComApp; // Version check /*string versionNumber = "08.11"; * if (!MSApp.Version.Contains(versionNumber)) * { * MessageBox.Show(string.Format("This Add-In was built for {0} {1}, please find the Arup Issue Tracker group in Yammer for assistance...", getBentleyProductName(), versionNumber), "Incompatible Version"); * return -1; * }*/ // Register reload and unload events, and show the form ReloadEvent += new ReloadEventHandler(AIT_ReloadEvent); UnloadedEvent += new UnloadedEventHandler(AIT_UnloadedEvent); // Run IPC app // RunAIT(); return(0); }
protected override int Run(string[] commandLine) { string unparsed = ""; app = Utilities.ComApp; //TestMdlMethods.getTypeElement(); //TestMdlMethods.getElementSize(); //TestMdlMethods.getElementRange(); //TestMdlMethods.mdlLine(); //app.CadInputQueue.SendKeyin("DemoForm Toolbar"); //CreateElement.LineAndLineString(unparsed); //CreateElement.ShapeAndComplexShape(unparsed); //CreateElement.ShapeHatched(); //CreateElement.GroupedHoleHatched(); //CreateElement.TextAndTextNode(unparsed); //CreateElement.CellAndSharedCell(unparsed); //CreateElement.LinearAndAngularDimension(unparsed); //CreateElement.CurveAndBsplineCurve(unparsed); //CreateElement.ConeAndBsplineSurface(unparsed); return(0); }
public static void LineAndLineString(string unparsed) { Bentley.Interop.MicroStationDGN.Application app = Bentley.MicroStation.InteropServices.Utilities.ComApp; Point3d startPnt = app.Point3dZero(); Point3d endPnt = startPnt; startPnt.X = 10; LineElement oLine = app.CreateLineElement2(null, ref startPnt, ref endPnt); oLine.Color = 0; oLine.LineWeight = 2; app.ActiveModelReference.AddElement(oLine); Point3d[] pntArray = new Point3d[5]; pntArray[0] = app.Point3dZero(); pntArray[1] = app.Point3dFromXY(1, 2); pntArray[2] = app.Point3dFromXY(3, -2); pntArray[3] = app.Point3dFromXY(5, 2); pntArray[4] = app.Point3dFromXY(6, 0); oLine = app.CreateLineElement1(null, ref pntArray); oLine.Color = 1; oLine.LineWeight = 2; app.ActiveModelReference.AddElement(oLine); }
public void FastPut() { ProcessNum = 0; ProcessMaximun = ElementPropList.Count; //MessageBoxService.ShowMessage($"The Number of ElementPropList is {ElementPropList.Count}", "Element number test"); BCOM.Application app = PDIWT_MS.Program.COM_App; BCOM.Point3d scale = app.Point3dOne(); BCOM.Matrix3d bmatrix3dx, bmatrix3dy, bmatrix3dz, bmatrix3dall; string cellName; BCOM.Point3d origin; foreach (var ele in ElementPropList) { cellName = string.Empty; foreach (var cn in CellNameList) { if (cn.Id == ele.CellNameType) { cellName = cn.Name; break; } } origin = app.Point3dFromXYZ(ele.X, ele.Y, ele.Z); bmatrix3dx = app.Matrix3dFromAxisAndRotationAngle(0, app.Radians(ele.AngelX)); bmatrix3dy = app.Matrix3dFromAxisAndRotationAngle(1, app.Radians(ele.AngelY)); bmatrix3dz = app.Matrix3dFromAxisAndRotationAngle(2, app.Radians(ele.AngelZ)); bmatrix3dall = app.Matrix3dFromMatrix3dTimesMatrix3dTimesMatrix3d(ref bmatrix3dx, ref bmatrix3dy, ref bmatrix3dz); if (!string.IsNullOrEmpty(cellName)) { BCOM.Element element = app.CreateSharedCellElement2(cellName, ref origin, ref scale, true, ref bmatrix3dall); app.ActiveModelReference.AddElement(element); } ProcessNum++; Bentley.UI.Threading.DispatcherHelper.DoEvents(); } MessageBoxService.ShowMessage($"所列单元创建完毕,共{ElementPropList.Count}个。", "创建完成", MessageButton.OK, MessageIcon.Information); }
public static void ScanBSplineSurface() { BCOM.Application app = Program.COM_App; BCOM.ElementScanCriteria sc = new BCOM.ElementScanCriteriaClass(); sc.ExcludeAllTypes(); sc.IncludeType(BCOM.MsdElementType.BsplineSurface); var ee = app.ActiveModelReference.Scan(sc); //var firstcurrent = ee.Current; var bsplinesurface = new List <BCOM.BsplineSurface>(); while (ee.MoveNext()) { bsplinesurface.Add(ee.Current.AsBsplineSurfaceElement().ExtractBsplineSurface()); } //foreach (var surface in bsplinesurface) //{ // //var surfacehandler = app.CreatePropertyHandler(surface); // //string s= surfacehandler.GetDisplayString(); //} BCOM.Point3d p1 = app.Point3dFromXYZ(200, 110, 100); BCOM.Ray3d ray1 = new Bentley.Interop.MicroStationDGN.Ray3d() { Origin = app.Point3dFromXYZ(200, 110, 100), Direction = app.Point3dFromXYZ(0, 0, -200) }; BCOM.Point3d insertpoint = app.Point3dZero(); BCOM.Point2d uv = app.Point2dZero(); foreach (var bsp in bsplinesurface) { if (bsp.IntersectRay3d(ref insertpoint, ref uv, ref ray1)) { string s = insertpoint.ToString(); string s2 = uv.ToString(); } } }
protected override int Run(string[] commandLine) { BCOM.Application app = Utilities.ComApp; app.CadInputQueue.SendKeyin("csAddins DemoForm Toolbar"); return(0); }
public static BCOM.ModelReference MdlGetModelReferenceFromModelRefP(this BCOM.Application app, IntPtr nativeModelRefP) { return(app.MdlGetModelReferenceFromModelRefP((long)nativeModelRefP)); }
public static BCOM.Element createPointElement(this BCOM.Application app) { var zero = app.Point3dZero(); return(app.CreateLineElement2(null, zero, zero)); }