Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all 7260 articles
Browse latest View live

Guidance for migrating VBA from v8i to CONNECT

$
0
0

Good Morning,

Does anyone know of any written guidance for anticipating where edits need to be made to get V8i MicroStation VBA routines working in CONNECT? 

Thanks very much for your time,


Development of an application for automatic drawing production using MicroStation Connect 10.13

$
0
0

Hello to everybody,

We are trying to convert two types applications from Microstation V8i (SS4) to Microstation Connect 10.13.01.01 based on .NET:

  • MDL Add in tools
  • .NET application which creates dgn files using the Microstation V8i InterOp

The replacement of MDL add-in tools with new ones developed using classes for .NET provided with the SDK would be feasible starting from the SDK examples.

The development of an external application for automatic drawing production seems to be more complex.

We went through SDK documentation and examples, but we couldn’t find the way to develop just a simple application which automatically starts Mstn Connect (or its services), creates a new dgn file and places a simple element, like a line.

 Can someone provides a solution?

Thanks in advance

Paolo

C# MSCE Update 13 Bentley.DgnPlatformNET.DgnPrimitiveTool

$
0
0

Hi All

Using C# in MicroStation CONNECT Update13

Just a quick question:

The .DgnPrimitiveTool does not appear to be part of the DgnPlatformNet.dll reference.

It works when I reference Bentley.DgnDisplayNet.dll

Is this the correct .dll to be referencing or should I be using another?

And is there any documentation on the DgnDisplayNet.dll and its classes?

Thank you in advance

Regards

Stephen

请问是否有MDL下,使用模态MFC对话框的完整例子?

$
0
0

各位专家好,请问是否有MDL下,使用模态MFC对话框的完整例子?

自行尝试的话,很多环境和头文件编译错误太多,也很难看懂,所以能否提供一个简单又完整的MFC模态对话框使用例子?

非常感谢!

Generate a dgn document using Connect SDK and C# without actually opening Microstation Connect program

$
0
0

Hello, I'm exploring Microstation Connect capabilities using Connect SDK, and I haven't found in the examples folder any sample that creates a dgn document from an indipendent executable, using microstation dlls.

I wanna simply do these steps:

  1. Initialize MS Connect license
  2. Create an empty document
  3. Add some drawings
  4. Save this document to a specified path

There's a way to do this without actually opening a MS Connect instance (i.e: microstation.exe)? Even better, there's a sample that shows hwo to do this?

Thanks for any kind of support.

Microstation v8 Addin

$
0
0

Is any possible to create Addin for Microstation v8 2004 edition for my  .net c# microstation application?

SDK API for obtaining and setting the "Locate Tolerance".

$
0
0

A user can run a key-in command: "Set Locate" to query the current "Locate Tolerance"  or key-in "Set Locate = 15" to set the "Locate Tolerance"  How is this accomplished problematically using the SDK?  Thank you.

viewgroups created with vba do not save

$
0
0

[connect]

i wrote a quick macro that creates a bunch of models, activates each of them to make a viewgroup for each of the models. however after closing the drawing none of the viewgroups are saved when it's opened next time. Am i missing something when creating each viewgroup that will allow them to save permanently?

Sub CreateModels()    Dim sourceModelToCopy As ModelReference    Set sourceModelToCopy = ActiveDesignFile.Models.Item("2757-502")    Dim i As Integer    i = 1    For i = 502 To 595        ActiveDesignFile.Models.Copy sourceModelToCopy, "2757-" & i    Next



End Sub


Sub ActivateViews()


    Dim objModelReference As ModelReference    Dim objViewGroup As ViewGroup    For Each objModelReference In ActiveDesignFile.Models        objModelReference.Activate    Next

End Sub

Sub RenameViews()

    Dim objViewGroup As ViewGroup    For Each objViewGroup In ActiveDesignFile.ViewGroups        I f Left(objViewGroup.Name, 4) = 2757 Then            objViewGroup.Name = Left(objViewGroup.Name, 8) & " Views"        End If    Next    Dim objModelReference As ModelReference
End Sub


Read Attribute from Element in C# .Net

$
0
0

I am using the following code for read the attribute from element by attributeIndex in c# .Net and Microstation V8 2004 Edition.But it shown errors like Unable to cast object of type 'System.Object[]' to type 'MicroStationDGN.DataBlock[]'..Is there any problem in my code?

 private string readAttribute(Element ele,int attribIndex)
        {
            String getStr = "";

            DataBlock[] dtBck = (DataBlock[])ele.GetUserAttributeData(attribIndex);
            if (dtBck.Length != -1)
            {
                dtBck[0].CopyString(getStr, false);
            }
            return getStr;
        }
 

mdlSelect_returnPositions API documentation seems incorrect in Microstation Connect SDK.

$
0
0

mdlSelect_returnPositions API documentation says you have to Free returned memory. It causes crashes if I do.  Do you still need to Free this memory in Microstation Connect SDK?  See code sample below.

void WatchMeCrash()
{   
  DgnModelRefP *fileNums; // = NULL; // fileNums was freed in Microstation V8i SDK.  Cannot in Microstaion Connect SDK.
  UInt32       *filePos;  // = NULL; // filePos  was freed in Microstation V8i SDK.  Cannot in Microstaion Connect SDK.
  int           numElems;

  if (TRUE == mdlSelect_isActive()) 
  {
    if (SUCCESS == mdlSelect_returnPositions(&filePos, &fileNums, &numElems))
    {
      mdlOutput_message(L"We got graphic elements selected...");

      if (filePos != NULL)
      {
        // The Remarks section from the Microstation SDK help for the mdlSelect_returnPositions()
        // function specify in exact words (cut and pasted here):
        // Remarks:
        // MDL applications should pass a pointer-to-a-pointer to a UInt32 for filePositions, and a pointer-to-a-pointer to an DgnModelRefP for modelRefs.
        // NOTE: each array is allocated internally by this function, but MUST BE FREED by the caller!
        free(filePos); // The offending line...
        free(fileNums);
      }
    }
  }
  else mdlOutput_message(L"You might want to select a graphic element before pressing the button!");
}

C# MSCE Update 13 Set named model to be the active model in the current MicroStation session

$
0
0

C# Microstation CONNECT Update 13

I have a .dgn file loaded in the current session of MicroStation which contains a design model named "default" and a sheet model named "Sheet1".

How can I set the active model programmatically by the name "Sheet1" so that it is the currently active model for the user in the current MicroStation session?

I can do it crudely by sending a key-in command to activate the model, but was hoping I could do this more directly with .NET.


Thank you

Regards

Stephen

[CE U13 C#] Error extracting vertices from some SmartSolids?

$
0
0

Hi all!

I'm facing a strange issue extracting vertices from SmartSolids (I haven't found this error using other kind of solids until now).

I'm using:

- mdlSolid_getVertexList to get the vertex list

- mdlSolid_listCount to check the numbers of the vertices and start a cycle

- mdlSolid_listNthEl to get the single vertex

- mdlSolid_idFromVertex to extract the vertex name

Everything is ok, until I appy this procedure to some Smart Solids and I get error 32768 in dlSolid_idFromVertex.

For example: I have a smart solid having 96 vertices, the list is extracted and the count is correct. The first 11 vertices are taken correctly, then I get a lot of errors, and finally I get the last vertex correctly.

This is really puzzling me...

Anyone else got a similar problem?

Thanks!

[Connect C++] list with all the "class name" types of an element

$
0
0

Hi,

Is there a way to get all the class name types that identify elements?
Typically for gathering the class name I'm using the following commands:

for (DgnECInstancePtr instance : ecMgr.FindInstances(*scope, *ecQuery))
	{
		DgnElementECInstanceP elemInst = instance->GetAsElementInstance();
		elemInst->GetClass().GetName(); // this is the class name of the element
	}

I need to be able to have a list with all the class name available, 
in order to compare them to know which one I'm dealing with while executing the code above with a *.dgn file open.
The comparison is necessary in order to execute different operation on the element that I'm parsing.


My configuration:
- Windows 10
- Visual studio 2015 
- Microstation SDK 10.13.00.48
- OpenPlant Modeler 10.04.00.30

Search for application DLL in MS Connect Edition destroyed by private path

$
0
0

We have earlier complaint about that a dll loaded in an mdl application cant be found via the path without getting any explanation. Now we have found out, that the problem is due to the fact that microstation.exe have  a microstation.exe.config applied with a “ prope localpath” definition which destroys the global path at looking for dll’s. We have also found out that there exist an environment parameter ‘ms_mdl’  making it possible for a mdl  application to attach a dll outside the private path,  but the problem turns up again when this dll in itself uses other dll’s where the  Microstation private path again rules.  Are there a solution for this except that all users has to copy all application dll’s to program  manager at every application update (manager rights demanded for this and the idea of a safe Microstation domain disappears)?   

I want to delete tags from all files excep one tag

$
0
0

I want to delete sets tags from all files except one ast tag which is seed2blk. Can someone help me with this .

I have 100s of files and i i want only one tag SEEDS2TBLK and remove all other tags from all files in a one process don't want to go manually for every file 

Is it possible to do with keyin or project manager ?

Please check the screenshot on tags

Please can anyone

  • I appreciate any answer to my question 

[MS CE U12] Accessing a Microstation running instance from excel

$
0
0

Hello,

I used to access Mirostation V8i from Excel with this code

    Set oMs = GetObject(, "MicroStationDGN.Application")

But it seems that, with the "connect" edition it does not connect anymore...

I receive this error :

ActiveX component can't create object (Error 429)

I use Microsoft office Professional plus 2013

I reference Bentley MicroStation 10.X Object Library 10.1

Many thanks for your help

Rémy

[CONNECT C#] Managed Equivalents for older COM Interop Calls

$
0
0

Hallo,

I am converting existing add-ins that were written in C# using the COM Interop on V8i SS4 to the new CONNECT NET API and I would like to get rid of any remaining calls to the COM Interface where possible. To achieve that goal, I need to find equivalents to some functions we used, such as:

On the LineElement class:
ProjectPointOnPerpendicular

On the application class:
GetFloodBoundary
Point3dInPolygonXY
Segment3dSegment3dClosestApproach
Ray3dRay3dClosestApproach

and a few other calls to the C libraries that I do not see in the SDK documentation, such as:
mdlElement_dropComplex from STDMDLBLTIN.DLL (it is possible that it is just undocumented in the SDK help file)

I have converted the rest of our Native imports to use longs and DPoint3d structs iso Point3d where appropriate so I do not foresee any problems with those.

I would appreciate any help, if someone can point me in the right direction with regards to equivalent calls on the Managed API that I can use to replace the COM Interface calls.

Thanks in advance,
Francois Grobler

[MStn CE U13 C#] Delete element (feature) from parametric solid directly

$
0
0

Hi,

even when this question is marked as C# API question, in fact it's about best practices and recommendation and C# was used to create test case only ;-)

Situation

When Parametric solid is created, it's stored as loosely binded elements. When an element is found by its ID, it's not treated as complex element component (because Parametric solid is not Complex Element) and can be modified directly.

It can lead to situation, when the element id is stored, in a meantime it's used to construct parametric solid, and later the element can be removed from DGN model. Such operation is done without any notification, but it leads to parametric solid invalidation and its conversion to a more primitive non parametric geometry.

My question(s)

Is it required to test every element, before it's deleted, whether it belongs to Parametric solid or not? Similarly to test whether an element is complex component (is a member of complex element)?

And when yes, what is the right way? In C++, is it SmartFeatureElement:IsSmartFeature for any element belonging to a parametric solid?

With regards,

  Jan

[Connect U13 C++] Forcing a Refresh on ViewDecoration

$
0
0

Hello all,

I am trying to draw a decorator around my cursor when the user has a certain key pressed.

bool Example::_DrawDecoration(IndexedViewportR viewport)
{
	if(!mdlWindow_isView (nullptr, statedata.current.gwP))
		return false;

	//MstnTool::GetCurrentMstnButtonEvent (MstnButtonEvent *ev)
	
	if(statedata.current.qualifierMask == 4)
	{
		auto output = viewport.GetIViewOutput();
		
		output->SetSymbology(DgnPlatform::Viewport::MakeTrgbColor(200,200,200, 128), DgnPlatform::Viewport::MakeTrgbColor(200,200,200, 128), 1, 0);
		DEllipse3d ellipse = DEllipse3d::FromCenterRadiusXY(statedata.current.dpUors, 10000.0);
		output->DrawArc3d(ellipse, true, true, NULL);
	}
	return true; //Bentley Note: A handful of internal implementations return true for a very specific purpose.
				// External implementations such as your own should always return false.
				// My Note: This needs to be true, otherwise the _draw method is not called when in a dynamic tool... Ex: Create Line
}

The decorator is working fine with the exception that when i let go of the key, the ellipse is still displayed until the cursor is moved again.

Also, when I first press the key, the ellipse does not show until the cursor is moved.

Currently, I have set a callback using SystemCallback::SetWindowsKeystrokeMessageFunction to notify me when the user has pressed \ unpressed the key, however I have not had any luck getting the view decoration to refresh.

I have tried setting Viewport.SetNeedsRefresh() and IndexedViewSet.UpdateView(), however neither of these seem to update the decorations, only transients.

Any suggestions would be great!

Thanks

[CONNECT C++] Element properties : way to access to the solid/hole properties

$
0
0

Hi everybody,

I now use the classes ElementPropertiesSetter and ElementPropertiesGetter to access and change the properties of the elements in replacement of the mdlElmdscr_setProperties...

One thing I can't find is the solid/hole properties. What is the best way to access and change it?

Thanks for your help,

Hervé

Viewing all 7260 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>