Hi!
Now I am testing a Microstation Connect. I wrote a small program that uses TerraScan functions.
One function causes an error: "Unable to load dialog form 'NEUTRAL?PROC' whose id is 90010".
How can I fix this error?
Please follow the MicroStation Programming forum best practices.
Please identify the version of MicroStation, or other product such as TerraScan, that you are using. What is the 8-digit version number (e.g. 10.xx.yy.zz) of MicroStation?
If you're using MicroStation in a ProjectWise (PW) managed environment, let us know that too.
Are you writing MDL, C++, C#, VB.NET or MicroStation VBA?
If you're creating a .NET application, are you building an AddIn in-process app. (i.e. a DLL) or a stand-alone app. (i.e. an EXE)?
Are you using Visual Studio or Bentley Make (bmake) to build your project? What version of Visual Studio are you using?
When you post code, use the Forum advanced editor's syntax highlighting tool. That's the icon that resembles a pencil:
Regards, Jon Summers LA Solutions
1. MicroStation 10.04.00.46 and TerraScan 17.005;
2. I use C#;
3. I build AddIn;
4. I use Visual Studio Community 2015;
5. Code is very simple:
[DllImport("tscan.dll")] private static extern int FnScanMarkFence(IntPtr Fst, IntPtr Lst); unsafe public int FnScanMarkFence(ref int Fst, ref int Lst) { try { IntPtr pFst = Marshal.AllocHGlobal(sizeof(Int32)); IntPtr pLst = Marshal.AllocHGlobal(sizeof(Int32)); int R = FnScanMarkFence(pFst, pLst); Fst = Marshal.ReadInt32(pFst); Lst = Marshal.ReadInt32(pLst); Marshal.FreeHGlobal(pFst); Marshal.FreeHGlobal(pLst); return R; } catch { return -1000; } }
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Can I ask one more question?
I can not create the shape. The program generates an error: HRESULT: 0x80070057 (E_INVALIDARG).
BCOM.Point3d[] vertices = new BCOM.Point3d[4]; vertices[0].X = pt.X - Size; vertices[0].Y = pt.Y + Size; vertices[0].Z = 0; vertices[1].X = pt.X + Size; vertices[1].Y = pt.Y + Size; vertices[1].Z = 0; vertices[2].X = pt.X + Size; vertices[2].Y = pt.Y - Size; vertices[2].Z = 0; vertices[3].X = pt.X - Size; vertices[3].Y = pt.Y - Size; vertices[3].Z = 0; element = app.CreateShapeElement1(null, ref vertices);
But the creation of the ellipse is working well:
element = app.CreateEllipseElement2(null, ref pt, Size, Size, view.get_Rotation());
Hi Maxim,
Unknown said:Can I ask one more question?
Please don't steal a discussion asking another question ... regardless it's your own thread ;-)
Unknown said:I can not create the shape. The program generates an error: HRESULT: 0x80070057 (E_INVALIDARG).
It's hard to say without knowing more about your project, especially what is app and how assemblies are referenced.
It seems that discussions on Internet about this error vary from access rights over cached obsolete files to wrongly configured project.
CreateShapeElement1 method works fine, attached is simple project I modified for quick test.
Unknown said:element = app.CreateShapeElement1(null, ref vertices);
element = app.CreateShapeElement1(
null
,
ref
vertices);
Why ref modifier is used? CreateShapeElement1 method is not defined this way I guess and it does not reassign the points array. Passing reference type object (which is array) is something different than passing (any) object using ref modifier.
With regards,
Jan
CreateShape.zip
Please ask as many questions as you want. But start a new thread for each new topic. In this case, making shapes & ellipses is unrelated to TerraScan.
When making a shape, by the way, the first and last points should be coincident (i.e. you need one more point in your array).
Unknown said:When making a shape, by the way, the first and last points should be coincident
It's not necessary, if the first and last points are not the same, the shape is closed automatically.
Regards,
Yes, It's not necessary.
I found a bug in the program.
Just had to change the properties of the reference (Bentley.Interop.MicrostationDGN and Bentley.Microstation).