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

Is it possible to estimate file size as per the elements in MVBA

$
0
0

Hello All,

I have same huge dgn files need to be converted to dwg, I have to split the dgn file into multiple files, otherwise dwg always fail. I'd like to know if it is possible to estimate the files as per the elements, such as a line is XXX byte, a circle is XXX byte, no need to be accurate. Thanks a lot.


Reference file location After Moving

$
0
0

How to get the Reference file Location after moving from Original location to another location for Reference file attached in Master File in Microstation V8?

C# Connect U12] Extract geometry / vertexlist from Shapes and Grouped Holes

$
0
0

Hi,

I am trying to extract list of points from Shape and Grouped Hole elements, but can't figure out how. I have looked at the other solutions but, it does'nt seem to work. My code looks like this:

BDPN.Elements.CurvePathQuery qry = BDPN.Elements.CurvePathQuery.GetAsCurvePathQuery(ele);

if (qry != null)
{
    BG.CurveVector vec = qry.GetCurveVector();

    if (null != vec)
    {
        BG.DPoint3d centroid;
        BG.DVector3d normal;
        double area = 0.0;
        vec.CentroidNormalArea(out centroid, out normal, out area);
        MessageBox.Show(centroid.X.ToString() + " - " + centroid.Y.ToString() + " - " + area.ToString());

        foreach (BG.CurvePrimitive cp in vec.ToList())
        {
            List<BG.DPoint3d > vertices = new List<BG.DPoint3d>();
            cp.TryGetLineString(vertices);

            MessageBox.Show(vertices.Count.ToString());
        }
    }
}

The part with CentroidNormalArea, works fine, returning the centroid coordinates and the area, but the last part where i try to get a list of Dpoint3D, does'nt work - whats wrong?

Regards Peter

Testing Design files for any issues.

$
0
0

Is there an app that can check for errors in a design file.

Like EDG used to do.

I am trying to scan files and print to PDF.

One file is crashing when I try to select certain elements for the ScanCriteria.

I tried compressing and that didn't help.

Microstation Connect SDK, cant find "MDL Function Reference Manual"

$
0
0

Hi Community,

Trying to get access to the MDL Function Reference Manual to get access to function wrappers for VBA.

Was told it comes with the Microstation SDK.

Have had my system administrator download and install it for me, but so far i cannot find it.

Does it come with Microstation Connect SDK? or do i need to download the Microstation V8i SDK?

Any assistance would be greatly appreciated.

Josh

VBA MDL styleparamsout run-time error '49': Bad DLL calling convention

$
0
0

Hi  Community,

Trying to get code below to work.

Have my main aim is to get the linestyle scale value of a level.

Have only recently been looking into mdl callouts for VBA.

have pieced this together from multiple sources like the connect SDK and the community here.

Believe its the styleparamsout thats making it fail, wondering where you get the breakdown of parameters, I made the StyleParam from another question here: https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/103030/getting-an-element-s-linestyle-parameters

My only guess is its different for V8i though not sure what version the questioner was using.

Is there a way to find this out?

Declare Function mdlLevel_getElementStyle Lib "stdmdlbltin.dll" _
    (ByVal styleOut As Long, _
    ByVal styleParamsOut As Long, _
    ByVal modelRefIn As Long, _
    ByVal levelIdIn As Long)

Const SUCCESS As Long = 0

Type StyleParam
    Modifiers As Long
    Reserved As Long
    Scale As Double
    DashScale As Double
    GapScale As Double
    StartWidth As Double
    EndWidth As Double
    DistPhase As Double
    FractPhase As Double
    LineMask As Long
    MlineFlags As Long
    Normal As Point3d
    RotMatrix As Matrix3d
End Type

Sub extractsymb()
    Dim oModel          As ModelReference
    Dim cout            As Long
    Dim cOout           As Boolean
    Dim lsout           As Long
    Dim lsparams        As Long
    Dim lsOout          As Boolean
    Dim wout            As Long
    Dim wOout           As Boolean
    Dim oLevel          As Level
    Dim levelid         As Long
    Dim oStyleparam     As StyleParam
    
    lsparams = VarPtr(oStyleparam)
    
    Set oLevel = ActiveDesignFile.Levels.Item("UTILITY_WATER_UNDERGROUND")
    levelid = oLevel.ID'''    If SUCCESS = mdlLevel_getSymbology(cout, cOout, lsout, lsparams, lsOout, wout, wOout, ActiveModelReference.MdlModelRefP, levelid) Then'''        Debug.Print "test"'''    End If'    If SUCCESS = mdlLevel_getElementStyle(lsout, lsparams, ActiveModelReference.MdlModelRefP, levelid) Then
        Debug.Print mdlLevel_getElementStyle(lsout, lsparams, ActiveModelReference.MdlModelRefP, levelid)'    End If
End Sub

Thanks,

Josh

[CONNECT C++] Reading dimension text size with annotation scale present

$
0
0

Hi folks,

I'm getting inconsistent results between V8i and Connect when reading the same DGN using similar SDK functions. I've attached the DGN. Both dimensions have a text size of 2.5mm, however, I get different results when using the dimensioning API.

Annotation scale does not appear to be set on the elements. I read annotation scale using this code. It seems to work, happy to be informed if this isn't the correct way to get this info from a dimension:

EditElementHandle elHnd ( elRef, modelRef );

auto ah = dynamic_cast<IAnnotationHandler*>( &elHnd.GetHandler () );

if ( nullptr != ah )
{
if ( ah->HasAnnotationScale ( dScaleP, elHnd ) )
{
iRet=BSISUCCESS;
}
}

I am guessing this type of annotation is stored as an XAttribute (XATTRIBUTEID_AnnotationScale) on the element, rather than in the dimension style. I'm also guessing this overrides the one in the dimension style?

In any case, for both dimensions in my file I get no annotation scale set. Then I read the text size from the dimension style using this code:

if ( dgnDimStyleP->GetBooleanProp ( biProp, DIMSTYLE_PROP_Text_OverrideHeight_BOOLINT ) == BSISUCCESS )
{
if ( biProp )
{
/*--- The text height is overridden from the textstyle ---*/
dgnDimStyleP->GetDistanceProp ( dRet, DIMSTYLE_PROP_Text_Height_DISTANCE, dgnModelCacheP );
}
else
{
/*--- The text height is defined by the textstyle ---*/
textStylePtr->GetProperty ( Bentley::DgnPlatform::TextStyle_Height, dTextStyleHeight );
}
}

Programmatically, on the dimension on the left, I get a height of 2500 UORs (2.5mm) and on the left I get a height of 1,250 UORs (1.25mm). Clearly this is wrong, because the terminators seem to be the same size. If I use "ANALYZE ELEMENT", it tells me that left is 2.5mm and right is 1.25mm text size. Similarly, the Match Dimension Attributes tool gives me the same results. If I check the annotation scale according to the dimension style, like this:

dgnDimStyleP->GetBooleanProp ( biUseAnnoScale, DIMSTYLE_PROP_Placement_UseStyleAnnotationScale_BOOLINT );

dgnDimStyleP->GetDoubleProp ( dAnnoScale, DIMSTYLE_PROP_Placement_AnnotationScale_DOUBLE );

Then I get biUseAnnoScale as TRUE and dAnnoScale as 100.0 for both dimensions.

So I can't see why one has the annotation scale already applied in the text size and one doesn't. Looking at the dimensions, the terminator arrow looks the same size. If I adjust the dimension text size on the right dimension to match the text size on the left, then it is 50 times too big, which is the model's annotation scale (which should be ignored according to the property DIMSTYLE_PROP_Placement_UseStyleAnnotationScale_BOOLINT).

It seems like there are some order of rules as to how to read and apply annotation scale in Connect, but I can't figure it out. In V8i, annotation scale was automatically applied to the dimension text size as I read it, so I didn't need to think about it. In Connect, it seems that sometimes it is and sometimes it is not, and I can't figure out how or why. What am I missing?

Cheers.

communities.bentley.com/.../850_2D00_m_2D00_12315_5F00_0_2D00_dims_2D00_4.dgn

[V8i SS3 VBA] find element contained other element

$
0
0

I need to get Ids of elements contained other elements like in the capture bellow using vba.

I should mentioned that I am working with 3D Model and some elements shouldn’t necessary intersect others .

Do you have any idea to start with ?top viewfront view


Extract Item types attached to models with VBA

$
0
0

Hi

I'm trying to extract item type property values from my active file's models trough VBA.

I've edited the item type property value I'm trying to extract so it's different in all models, but I seem to often end up with the same value for all models, although I sometimes get some of the different values printed correctly. What could I be doing wrong?

Sub FindItemsFromModelReference3()

    Dim oItemLibs As ItemTypeLibraries
    Dim oItemLib As ItemTypeLibrary
    Dim oItem As ItemType
    Dim oItemPropHandler As ItemTypePropertyHandler
    Dim tests As String
    Dim oItems As Items
    Dim Success As Boolean
    Dim mdl As ModelReference
    
    For Each mdl In ActiveDesignFile.Models
        Debug.Print mdl.Name
    Set oItems = mdl.Items
    oItems.Refresh ("Ritningsinfo")
    Do
        Set oItemPropHandler = oItems.Find("Ritningsinfo", "Stämpel", oItemPropHandler)
        If oItemPropHandler Is Nothing Then
        Exit Do
        Else
        Debug.Print oItemPropHandler.GetPropertyValue("Rad 2")
        End If
    Loop
    Next
End Sub

I'm running Openbuildings designer connect edition update 5. 

Regards, 

Robert

Listing Elements ID from .dgn file.

$
0
0

Hi All,

I need to find how can I list all of elements IDs from the .dgn file from Microstation. I prefer to use some macro in VBA, but I don't have any idea how to write it. Can you help me? I also find a KEY-IN command - ELEMENT LIST which should generate .ULF file with IDs and position of each element, but I don't know how to open it. I will appreciate every help!

Best regards 

Michal 

[CONNECT .NET C#] How to change the view attributes of a reference file programatically?

$
0
0

Is it possible to change the "View attributes" of a reference file(Reference presentation)? The attributes i wanna change is the Level Overrides, Line Styles, Line weights etc. (As shown on the picture below).

Latest version of Microstation CONNECT Edition SDK

$
0
0

What is the latest version of Microstation CONNECT Edition SDK and where can I find it? I currently use v10.11.00.39.

Export report VBA

[CONNECT U13 C#] How to reverse a linear element with dotNet API?

$
0
0

Hi all,

Does somebody know how to reverse (in C# code) an element (line(string), arc, complex chain)?

By using the new dotNet API, not using interop...

Installing SDK CE U12 issues.

$
0
0

TRying to build the SDK examples: They all fail to build. Pleas look ar the extract from the log file:

BMAKE: Error - Cannot find the .Net tools location for this toolset. VS2017_DotNetToolsDir was not defined, and registry lookup failed.

BMAKE: call trace
    line:   96, C:\PROGRA~1\Bentley\MICROS~2\mki\VCVarsQueryRegistry2017.mki
    line:  960, C:\PROGRA~1\Bentley\MICROS~2\mki\AssertToolSet.mki
    line:  114, C:\PROGRA~1\Bentley\MICROS~2\mki\ConfigurePolicy.mki
    line:   26, C:\PROGRA~1\Bentley\MICROS~2\mki\mdl.mki
    line:   17, C:\PROGRA~1\Bentley\MICROS~2\examples\ANNOTA~1\DESCRI~1\DESCRI~1.MKE

Anyone,please?

Installed SW:

MicroStation CE U12 10.12.0.40

MicroStation CE SDK 10.12.00.043

Visual Studio Prof. version 15.9.28307.858


SmartSolid Union Runtime Error -9078

$
0
0

I'm applying a Smart Solid Union to a series of cone elements with increasing lengths that fan out from a common point. As the smart solid cone faces become somewhat parallel i get a Runtime error -2147212426 (80042376) msdError -9078.

When manually testing the union with the new cone merged shape I get the same error.

I have modified the cone shape to try and provide some intersecting faces.....but this does not seem to work

I am using Microstation Select Series 10: Version 08.11.09.908

Is there any way to read Microstation SE version cell library information (Name, Description) using c# ?

$
0
0

Hi, I would like to read Microstation SE cell information (cell name , description) from cell library using c#. Is it possible, if so how ?

[CE U13 C#] Measure Volume Elements

$
0
0

I want to measure a simple volume (solid) element but with the code below, CurveVector is null. As it looks, CurveVector is not right for that element.

public static decimal getValueAsDecimal(Bentley.DgnPlatformNET.Elements.Element ElementIn, MSElementProperties elemPropIn)
      {
         decimal decValue = 0;
         CurveVector c = CurvePathQuery.ElementToCurveVector(ElementIn);


         if (c == null)
            return 0;

         switch (elemPropIn)
         {
            case MSElementProperties.Area:
               {
                  double dArea;
                  DPoint3d pt;
                  DVector3d normal;

                  c.CentroidNormalArea(out pt, out normal, out dArea);
                  decValue = (decimal)dArea;
                  break;
               }
               ...
                return decValue;
      }

Problem with SmartSolid.SolidUnion and SmartSolid.SolidSubtract

$
0
0

Hello,

I'm currently developing an AddIn for V8i and CE, that is a catalog of our parts. We have a mdl version of it without the usage of union and differences.

The gemoetry information is coming from a catalog database (cuboid, cylinder, union, diference, ...)

SmartSolid.SolidUnion and SmartSolid.SolidSubtract fail nearly each time.

How can I create solids that are a combination of different operations (adding peaces together and cut a hole into it)?

Thanks

Norbert

[CONNECT C++] MstnElementSetTool and ElementToCurveVector()

$
0
0

In my model, I have Lines and LineStrings. I am using ElementToCurveVector() to get CurveVector objects for determining intersections. When picking a LineString, is it possible to take ONLY the segment of the LineString that the user choose with the datapoint INSTEAD of the entire LineString and somehow create a CurveVector (such that it represents a line verses a lineString)? The tool is a multiple pick tool that requires the user select 2 elements. Are the HitPaths stored as part of the ElementAgenda?

Thanks,

Bruce

Viewing all 4331 articles
Browse latest View live


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