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

RE: [Connect COM/ VB, C#] CreateShapeElement1 error

$
0
0

Hi Jan,

Just to clarify, we are not talking about add ins for MicroStation.

I have a VB.NET 64bit, 4.5 framework, standalone application and I referenced COM object:

I do not reference Bentley.interop.microstation.dll

I think Bentley.Interop.microstation.dll is for add ins or am I wrong?

cheers

Nenad


RE: [Connect COM/ VB, C#] CreateShapeElement1 error

$
0
0

[quote user="Nenad Poljcic"]In Visual Studio Object Browser and parameter <vertices> is System.Array[/quote]
In a COM interface, all arrays are of type System.Array

If you dig into the Microsoft documentation, you will find that System.Array is a multi-dimensional array of Variant. The API should take care of converting between, say, Point3d() and System.Array.  You can't simply cast to System.Array.  It's better to let the API do the work for you.

RE: [Connect COM/ VB, C#] CreateShapeElement1 error

$
0
0

Hi Jon

"..  It's better to let the API do the work for you."

I tried your approach but it produced same error.

any ideas?

cheers

Nenad

RE: [Connect COM/ VB, C#] CreateShapeElement1 error

$
0
0

Hi Nenad,

[quote user="Nenad Poljcic"]I think Bentley.Interop.microstation.dll is for add ins or am I wrong?[/quote]

I think it's not true, bentley.interop.microstationdgn.dll assembly can be used both in addins and external applications and MicroStation DGN object library is designed to be used for VBA interprocess communication. But I am not an expert for this topic.

[quote user="Nenad Poljcic"]I do not reference Bentley.interop.microstation.dll[/quote]

Attached is simple VS2013 project for MicroStation V8i: It connects (or starts if not active) to MicroStation and uses your code to place a shape. It uses Interop assembly and it seems to work fine (of course you will have to change it to use different dgn file).

With regards,

  Jan

(Please visit the site to view this file)

[Connect COM/ VB, C#] CreateShapeElement1 error

$
0
0

Hi,

I have a code that works in V8i but produces error in Connect:

             MicroStationDGN.Application myMSapp = new MicroStationDGN.Application();
             MicroStationDGN.Point3d[] vertices = new MicroStationDGN.Point3d[4];
             vertices[0] = myMSapp.Point3dZero();
             vertices[1] = myMSapp.Point3dFromXYZ(1000, 0, 0);
             vertices[2] = myMSapp.Point3dFromXYZ(1000, 1000, 0);
             vertices[3] = myMSapp.Point3dZero();
             MicroStationDGN.ShapeElement shape;

             System.Array vArray = (System.Array)vertices;

             shape = myMSapp.CreateShapeElement1(null, ref vArray, MicroStationDGN.MsdFillMode.msdFillModeNotFilled); // error in this line




System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Any idea?

I tryed code in VB and C# but getting same error.

thanks

Nenad

RE: Change Model Properties in VBA

$
0
0
Chuck,

Did you successfully create a macro?

Travis

RE: [Connect COM/ VB, C#] CreateShapeElement1 error

RE: Change Model Properties in VBA

$
0
0

[quote user="Flounder_Pounder"] Did you successfully create a macro?[/quote]

What do you need that isn't covered either by Jan's suggestion or by this example from VBA help?

Sub CopySheets()
    Dim mdlTemp As ModelReference
    Dim sd As SheetDefinition
    
    Set sd = ActiveModelReference.GetSheetDefinition
    
    For Each mdlTemp In ActiveModelReference.DesignFile.Models
        If mdlTemp.Type = msdModelTypeSheet Then
            '
            '  The same sheet definition can be applied to
            '  all sheet models.
            '
            mdlTemp.SetSheetDefinition sd
            '
            '  Change all of the elements in the model to use
            '  the new annotation scale.
            '
            mdlTemp.PropagateAnnotationScale
        End If
    Next
End Sub


Change Model Properties in VBA

$
0
0

Before I jump into this, I thought I'd ask here first.

Does anyone have some VBA code that changes a model from design model to a sheet and then applies some of the additional properties that become available once a model is a sheet?

I tried recording a macro, but the result was not useful.

I am using InRoads to create plan and profile sheets. But it does not know sheets models from design models, so after its complete, I need to open evey sheet, change the model to a sheet, assign a scale, select a sheet size and tell it which reference file is my sheet.

And then, if I have to rerun the plan and profile generator, it all gets reset and I have to start all over again..

RE: [Connect API] Missing headers/declarations in SDK

$
0
0

Hi Nenad,

this issue is also reproducible with the latest SDK version 10.3.0.30.
I have filed the Defect # 641666 to address this issue.

Best regards,

Artur

RE: VB.Net: Capture native form open or close event via Microstation Add-in

$
0
0

Hi Dave,

I think it's not possible. You can create modal dialog events handler using addin COM API, but it's about modal dialogs only.

VBA/COM API is limited in V8i and does not allow full integration with MicroStation. Even more, addin API is usually (not specifically in MicroStation) designed to run isolated without interaction with other loaded addins. Such approach is in parallel with general NET security philosophy.

Maybe it can be implemented using MDL native C code, but I'd like to ask why you need to monitr the dialog open event, especially if you want to monitor MicroStation dialogs and dialogs of other applications?

With regards,

  Jan

VB.Net: Capture native form open or close event via Microstation Add-in

$
0
0

Hello,

I've written an Addin (or I should say using modified Addin Jan Slegr had written...very nice, by the way) and I'm wondering if there is some way I can capture load and unload events of native forms or forms from other Addins? I wrote a plug in for Promis.e and was able to add form opening and closing event using the eventcenter in their ECT.ECAD.API dll and I was wondering if there was some equivalent in the Bentley.MicroStation.AddIn Namespace?

Thanks Dave

RE: [C# Connect] Create/link a child element to (parent element)

$
0
0

Hi Pierre,

in my opinion there are two many options / ways discussed in your question, which makes an answer too complicated. I recommend to narrow down possible situations to only one with exactly defined conditions and requirements.

[quote user="Pierre El-khoury"]I want to link and highlight an element with an attribute /tag or ItemProperty of that element.. for example[/quote]

You mentioned 3 different MicroStation technologies how to store custom data. Lets limit it to the way preferred in CONNECT Edition, which are ItemTypes (as a subset of EC technology).

[quote user="Pierre El-khoury"]I would like to show this property as a text that is related to the element.[/quote]

I think it's always good to check if a required functionality is available in MicroStation itself and use a compatible implementation. In the case of ItemTypes, values can be displayed in at least two ways:

  • Using text fields
  • Using labels

It seems labels are better, because a topoogye relation to elementis established, so when the element moves, the label moves also. If such behaviour is fine for you, you should try to use the same approach.

[quote user="Pierre El-khoury"]I was doing that by creating a child element of type text that holds the value of ID.[/quote]

What do you mean by "child element"? This terms is used at different places in DgnPlatfromNet API, so I am not sure if I understand correctly your implementation.

[quote user="Pierre El-khoury"]but I think this complicates the code more than necessary[/quote]

I prefer to focus on a compatibility with MicroStation tools and features. You should specify your requirements and priorities at first (e.g. if it should work without your application, what type of data will be displayed, if it should be compatible with lables etc.) and based on such specification it can be evaluated what API and in what way should be used.

With regards,

 Jan

[C# Connect] Create/link a child element to (parent element)

$
0
0

Hej

 I want to link and highlight an element with an attribute /tag or ItemProperty of that element.. for example The element I have in hand have an (ItemProperty = ID) I would like to show this property as a text that is related to the element. I was doing that by creating a child element of type text that holds the value of ID. So when the user moves the parent element the child will follows. I found a way to do that by creating a cell header and link the parent and child to the cell header but I think this complicates the code more than necessary is there any example how to create/link a direct child of an element.

Best regards

 Pierre

RE: Run Microstation macro from Excel

$
0
0

Identify Your Platform

Please identify the version of MicroStation, or other product such as PowerDraft, that you are using: MicroStation CONNECT or MicroStation V8i. What is the 8-digit version number (e.g. 10.xx.yy.zz) of MicroStation?

Identify Your Operating System

Please identify the version of Windows you are using. Is this 32-bit or 64-bit Windows?

Code Syntax Highlighting

When you post code, use the Forum advanced editor's syntax highlighting tool. That's the icon that resembles a pencil:  Syntax Highlighter

The AI of DGN Files

[quote user="sachin patel"]I have at least 300 2D non-intelligent MicroStation DGN files[/quote]

  • What is a 'non-intelligent MicroStation DGN file'? 
  • What characteristic would an 'intelligent MicroStation DGN file' have?

[quote user="sachin patel"]Each file containes Piping Isometrics Generated From "Smart Plant Isometrics"[/quote]

What format are those DGN files: MicroStation V7 or V8?

Example Data

Can you provide sample data?

  1. A small DGN file that shows the tags you want to export
  2. An Excel workbook that shows how you want the exported data to appear


RE: Run Microstation macro from Excel

$
0
0

Hi sachin,

I am not sure what you are asking for: If such macro exists and an owner is willing to share; whether somebody is able to write such macro (free or commercially); or whether your idea is create the macro yourself and would like to receive an advice how to start?

Regarding to the described workflow: It seems to me like too complicated description with using not necessary assumption of technical solution (using key-ins, clipboard etc.). Can it be simplified to this form?

  1. There are design files in a folder.
  2. Every design file should be opened to default model.
  3. The model is searched for specific tags (tagsets + tags with defined names).
  4. If such tags are found, their values should be copied to Excel sheet.

I don't see any reason for a manual interaction, because tag extraction to Excel can be done fully automatically. And such workflow does not require to start the macro from Excel or from MicroStation, which makes the implementation easier.

Can you share a sample of your design files to demonstrate how tags are complex and how they are structured?

With regards,

 Jan

Run Microstation macro from Excel

$
0
0

Hello,

I Have Atleast 300 2D non-intelligent Microstation DGN files. Each file containes Piping Isometrics Generated From "Smart Plant Isometrics".

Each file having few support Tags written in it. each file has atleast average 12 supports. 

What i am doing now is manually opening each file and writting which file has which support tag written and i am manually entring it into Excel.

What i Want is  Any Excel Macro that i could run from excel .so that it will open First dgn in folder (macro should be such that i could define folder path manually) and Run Keyin and Enter "macro XYZ in key-in (xyz macro just select all data in dgn and copy to clipboard .so that i have everything in clipboard) and return back to excel and just paste data.

then jump to second dgn and so on.. once i got all data then i can filter support tag out of it manually easily. 

RE: [CONNECT C++] GeoCoordinates Usage

$
0
0

Anyone ?

Bentley::DgnGCSP		pModelGCS = NULL;
pModelGCS = Bentley::GeoCoordinates::DgnGCS::FromModel (currentModel, TRUE);

 

generates a linker error:

error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct Bentley::GeoCoordinates::DgnGCS * __cdecl Bentley::GeoCoordinates::DgnGCS::FromModel(struct Bentley::DgnPlatform::DgnModelRef *,bool)" (__imp_?FromModel@DgnGCS@GeoCoordinates@Bentley@@SAPEAU123@PEAUDgnModelRef@DgnPlatform@3@_N@Z)

 

name mangling perhaps ?

 

Thanks,

Bruce

RE: [CONNECT C++] GeoCoordinates Usage

$
0
0

[quote user="Bruce Reeves SRNS"]I've included both BaseGeoCoord.lib and Bentley.GeoCoord.lib, but still the linker errors...[/quote]

Try the following...

  • BentleyGeom.lib
  • DgnPlatform.lib

RE: [CONNECT C++] Getting RawItem of menu in dialog

$
0
0

[quote user="Frode Tørresdal"] These functions requires a RawItemHdr of the menu bar[/quote]

This works in V8.  I haven't tried it in CONNECT...

/////////////////////////////////////////////////////////////////////////////
//	Gets a ptr to RawItemHdr of MicroStation main menu bar
bool                    mainMenuBarGet
(
RawItemHdr**            menuBarPP,  //	<=	pointer to menu bar
DialogBox**             dbPP        //	<=	pointer to dialog box
)
{
        RawItemHdr*     menuBarP  = NULL;
        DialogBox*      dbP       = NULL;
        DialogItem*     diP       = NULL;
        
        dbP = mdlDialog_overallTitleBarGet ();
        if (NULL == dbP)
            return false;
        diP = mdlDialog_itemGetByTypeAndId (dbP, RTYPE_MenuBar, MENUBARID_Main, 0);
        if (NULL == diP)
            return false;
        menuBarP = diP->rawItemP;
        
        if (dbPP)
            *dbPP       = dbP;
        if (menuBarPP)
            *menuBarPP  = menuBarP;
        return true;
}

Viewing all 7260 articles
Browse latest View live


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