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

[CONNECT] Detect Associative Region Element

$
0
0

I'm attempting to measure the area of shapes in a DGN model.  If my model scanner finds a shape or complex shape then the measurement is straightforward.

Some things that look like shapes are associative regions.  They seem to be a cell named AssociativeRegion containing a single shape element. I can write a class to analyse that object, but am I missing something in the API?  Is that a sufficient and consistent construction of an associative region?  I can see a C++ handler for associative regions (AssocRegionCellHeaderHandler), but I don't see its analog for .NET.


[CONNECT Update 12 C] 'native C' migration from V8i

$
0
0

Hello,

I am on a migration project from V8i (native C) to CONNECT.
Different messages found on different forums are not clear for me...
The existing project is composed of 50000 lines of code - native C.
My goal is to minimise the changes to complete the migration.
==> The main question is "are native C projets still supported with CONNECT edition ?"

It seems that the migrate tool is *just* a string remapping from old V8i/C to CONNECT/C++.
For example, the constant 'UNIT_ANGLE_Radians' is remapped by 'StandardUnit::AngleRadians'
Surely this kind of syntax cannot be compiled in C file (but in a C++ file).
How can I use this tool if I want to stay in native C ?

It seems that the provided makefiles are not working with .C extension files.
The following message is displayed when the source file is a .C one : "This file is for C++ compilands only"
Is there a way to use those makefiles (with a define or someting) or are there specific makefiles available ?
 
On the other hand MicroStationCONNECTSDK\include\Mstn\MdlApi contains the needed .H (and .FDF) files with the 'C' functions prototypes.
For example 'mdlScan_initialize()' defined in msscan.fdf found in V8i SDK and CONNECT SDK.
So to me it must be a way keep using those old 'native C' API... No ?

Thanks a lot, Pascal.

Error building examples for update 12 SDK

$
0
0

When building C++ examples for the update 12 SDK it fails with the following error:

-MANIFESTFILE:C:\Users\doug\AppData\Local\Temp\Bentley\MicroStationSDK\objects\ModelExample.dll.Manifest
C:\Users\doug\AppData\Local\Temp\Bentley\MicroStationSDK\objects\ModelExample.obj C:\Users\doug\AppData\Local\Temp\Bentley\MicroStationSDK\objects\ModelExampleHelper.obj B:\Apps\Bentley\library\bentley.lib B:\Apps\Bentley\library\BentleyAllocator.lib B:\Apps\Bentley\library\mdlbltin.lib B:\Apps\Bentley\library\RmgrTools.lib B:\Apps\Bentley\library\BentleyGeom.lib B:\Apps\Bentley\library\DgnPlatform.lib B:\Apps\Bentley\library\ECObjects.lib B:\Apps\Bentley\library\dgnview.lib gdi32.lib user32.lib kernel32.lib C:\PROGRA~2\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64\msvcrt.lib
B:\Apps\Bentley\library\mdlbltin.lib
LINK : fatal error LNK1181: cannot open input file 'C:\PROGRA~2\Microsoft.obj'
BMAKE: call trace
    line:  414, B:\Apps\Bentley\mki\dlmlink.mki
    line:  106, B:\Apps\Bentley\examples\Model\ModelExample\ModelExample.mke
Mon Nov 04 23:23:11 2019, elapsed time: 0:00

Clearly the space in the path:

C:\PROGRA~2\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64\msvcrt.lib

Is causing problems.  I'm guessing it needs to be quoted somewhere, but I have been unable to locate where it is specified.

VBA SetValue method for PropertyHandler in AECOsim BD

$
0
0

[AECOsim V8i SELECTseries 6 VBA]

[AECOsim CONNECT VBA]

Hello everyone,

To continue previous discussion ( .../programming/microstation_programming/f/microstation-programming---forum/184516/vba-propertyhandler-setvalue-method )

with new question about SetValue method...

So, I have a simple code for  porperties changing:

Sub change_prop()
    Dim oTarget As Element
    Dim OPH As PropertyHandler
    Dim a As DLong
    a = DLongFromString("726841")
    Set oTarget = ActiveDesignFile.GetElementByID(a)
    Set OPH = CreatePropertyHandler(oTarget)
        OPH.SelectByAccessString ("StructProp__x002f____x0040__StructCode")
        Debug.Print OPH.GetValue
        OPH.SetValue ("Architect")
        Debug.Print OPH.GetValue'oTarget.Rewrite'oTarget.Redraw
End Sub

Here is element in my model and its properties:

Property "Code" have value "Previous Example". In vba code i change the property by its name (name is long, but its right), a new value should be "Arcitect".

So, the problem is that the value is not saved after "End Sub".

What i can see in Immediate window after code was started TWO times:

Value changes while code is running, but have previous value after Sub.

Rewrite, Redraw methods do not change the result.

Everything is ok with changing Line weights, layers for example,  but not this "string" properties.

Its strange, that new value does not applied.

May be some settings of added properties for catalog elements should be corrected? Or may be code is not complete?

Print pdf without open MicroStation UI

$
0
0

OpenDesignFileForProgram seems not work for pdf printing. Can suggest how to do it if I want to export pdf without opening MicroStation UI?

Batch Process: Attaching Reference with Relative Path

$
0
0

Hello MicroStation novice here!

I have been working with MicroStation and the batch process tool for almost 2 years and have gotten to save us a lot of time doing so. However with all the scripts I was able to make, I could never figure out how to attach a reference to a file with the relative path but only through an actual path. 

reference attach "C:\Users\2263\Desktop\Batch Process\YYYY-TB44x36.dgn",,,*,,,
reference levels off ALL YYYY-TB44x36.dgn;selview 1
reference levels on Default,A-ANNO-NOTE,A-TB,A-TB-0GRID,A-TB-TEXT,NOPLOT YYYY-TB44x36.dgn;selview 1
filedesign
save design

It is important to us that all of the files we attach have the paths as relative for the clients use after the design is complete. I have done research and seen people recommend MDL apps to help but I don't understand them all too well. If someone could guide me to an article that helps explain them or the problem I am having would help a bunch!

[V8i SS4] Where are the TCB expressions listed?

$
0
0

Yes, I probably have the nomenclature wrong...
I remember being able to use the C expressions for the TCB to set all sorts of values, but it was a very long time ago (MicroStation Basic days).

Is there anywhere in the plain MicroStation install package where I might find a list of all those?
Thank you.

MaryB

King Khan VBA help request

$
0
0

Hi,

I was sent a private email from "King Khan" which reads:

Please help me SIR ROBERT
i am a newbie engineer from india i started working on MicroStation from 3 months back i want to learn VBA, basic macro, i jave thousands of files but less time as i belong too poor family i don't have money to keep and learn please helo me to learn about vba, and macro from basics it will be very helpful
Links please to learn with basics
I appreciate if you could help me in making my future better by learning microstation

This request seems more appropriate for a forum than for a private request. 

My first suggestion would be to do a Google search for "learn vba."  Even if it is related to Excel, it will be a good start.  You could continue with a Google search for "Microstation VBA" and find things like:
https://communities.bentley.com/products/microstation/w/microstation__wiki/8775/getting-started-with-visual-basic

You may also look into books, like "Learning MicroStation VBA"

--Robert


[CE U12 - VBA] Password protected VBA's do not display in macros list

$
0
0

After loading a password protected .mvba file none of the macros in the project display in the macros drop-down list. Loading non-password protected projects all of the macros are displayed in the list. Even entering the password to unlock the protected project the macros are not displayed.

The only way for a user to run a macro from the protected vba is to issue the vba run key-in. 

[CONNECT C#] License information

$
0
0

Is there a way in .NET to retrieve the current license information like what is shown in the "About MicroStation" dialog where it shows "This product is licensed to:" then shows the username and company?

Either a COM or new .NET platform solution will work.

Connect Version 13 C# Programming - ScanCriteria

$
0
0

Hello to All, I am having issues with ScanCriteria scanning and finding elements, I have attached the code below:

Any help would be appreciated.  In vb.net coding I used the Bentley.Interop.MicroStationDGN assembly which is a different scan process. I would like to use the Bentley.DgnPlatformNET assembly in my C# programming.

Thank you, Donna Rodrick

using Bentley.DgnPlatformNET;
using Bentley.DgnPlatformNET.Elements;

namespace SheetManager
{
 public partial class CtSheetManager : Form
 {
    //other code
 

    List<BDPN.Elements.Element> scanEls = new List<BDPN.Elements.Element>();
    scanEls.Capacity = 100;
    using (ScanCriteria scanC = new ScanCriteria())
    {
        List<MSElementType> elementTypes = new List<MSElementType>
        {
            MSElementType.Text
        };
        scanC.AddElementTypes(elementTypes);
        elementTypes.Clear();

        List<DgnElementClass> classTypes = new List<DgnElementClass>
        {
	        DgnElementClass.Construction
        };
        scanC.AddClassTypes(classTypes);
        classTypes.Clear();

        scanEls = scanC.Scan(dgnModel);
    }
    
    //more code

i have record a macro to find/replace 3 texts but its getting stop every single time it replaces the text

$
0
0

>i have record a VBA to find/replace 3 Words but its getting stop every single time it replaces a word. A small windows pops up asking me to "press OK" search completed and every time i need to press OK for next step. please help to use this in correct way

>I have 300 files nearly please help me to  use this VBA  as batch process  so i can replace the text in all files

i have attached a popup window dialog box picture. waiting for someones answer who have the knowledge of VBA if any one could help me now i would be very thankful.  i have to submit this files soon

any answer would be appreciated thanks

Sub Macro1()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long

' Coordinates are in master units
startPoint.X = 0.860905733419942
startPoint.Y = 0.283392695373664
startPoint.Z = 0#

' Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

' Start a command
CadInputQueue.SendCommand "MDL LOAD CLIPBRD COPY"

CadInputQueue.SendCommand "MDL KEYIN FINDREPLACETEXT,CHNGTXT CHANGE DIALOGTEXT"

' Send a keyin that can be a command string
CadInputQueue.SendKeyin "FIND DIALOG ZOOMLEVEL 16"

CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING DAMMMAM"

CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING SCOPE OF WORK & TECHNICAL SSPECIFICATION"

CadInputQueue.SendKeyin "FIND DIALOG REPLACESTRING SCOPE OF WORK & TECHNICAL SPECIFICATION"

CadInputQueue.SendKeyin "CHANGE TEXT FIND"

CadInputQueue.SendKeyin "CHANGE TEXT CHANGE"

point.X = startPoint.X + 2.43219019862252E-02
point.Y = startPoint.Y - 9.29615424449349E-02
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

point.X = startPoint.X + 1.25583135851272E-02
point.Y = startPoint.Y - 0.128082096652338
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

CadInputQueue.SendCommand "MDL LOAD CLIPBRD COPY"

CadInputQueue.SendCommand "MDL KEYIN FINDREPLACETEXT,CHNGTXT CHANGE DIALOGTEXT"

CadInputQueue.SendKeyin "FIND DIALOG ZOOMLEVEL 16"

CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING SCOPE OF WORK & TECHNICAL SSPECIFICATION"

CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING JAFARI"

CadInputQueue.SendKeyin "FIND DIALOG REPLACESTRING JAAFARI"

CadInputQueue.SendKeyin "CHANGE TEXT FIND"

CadInputQueue.SendKeyin "CHANGE TEXT CHANGE"

point.X = startPoint.X + 0.371685265789714
point.Y = startPoint.Y - 0.424362606539024
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

point.X = startPoint.X - 1.62802247904091E-02
point.Y = startPoint.Y - 0.286172170816244
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

point.X = startPoint.X - 1.62802247904091E-02
point.Y = startPoint.Y - 0.286172170816244
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

Dim modalHandler As New Macro1ModalHandler
AddModalDialogEventsHandler modalHandler

' The following statement opens modal dialog "Edit Tags [SEEDS2TBLK]"

CadInputQueue.SendKeyin "edit tags"

CadInputQueue.SendKeyin "choose element"

point.X = startPoint.X + 0.117175657415151
point.Y = startPoint.Y - 0.301600853589438
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING DAMMMAM"

CadInputQueue.SendKeyin "FIND DIALOG REPLACESTRING DAMMAM"

CadInputQueue.SendKeyin "CHANGE TEXT FIND"

point.X = startPoint.X + 0.132222402492848
point.Y = startPoint.Y - 9.11344615902145E-02
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

CadInputQueue.SendKeyin "CHANGE TEXT FIND"

CadInputQueue.SendKeyin "CHANGE TEXT CHANGE"

RemoveModalDialogEventsHandler modalHandler
CommandState.StartDefaultCommand
End Sub..

i have v8 dgn files nearly 100+ and i want to remap them all

$
0
0

i have v8 dgn files nearly 100+ and i want to remap them all using batch convert 

the procedure i do to batch convert is

i have made a csv file and i have attached it under save as option under batch process

and when i  start batch process its showing me in status up to date what would be reason please someone help. my much time would be saved if i able use this batch convert option fro level remapping my all files

any answer would be appreciated i would remember him a long time. i am attaching a screenshot for the status what i  am getting please have a look and help me in this

Help me about filtering level scan element issue in mdl v8!

$
0
0
I'm programming c on mdl microstation v8.5. I don't understand issue about scanning element with filtering level: scanList.levmask [0], scanList.levmask [1], scanList.levmask [2], scanList.levmask [3]. I want to filter level 10,23,32,can you explain it for me. Thanks

[CONNECT C++] equivalent function for mdlSolid_slice but with ISolidKernelEntityPtr

$
0
0

Hi,

I would like to replace the 'old' API mdlSolid_* in my code and work with SolidUtil and ISolidKernelEntityPtr etc.

Is there equivalent function for mdlSolid_slice?

Kind regards,

Harmen


Master File Element and Reference File Element at same location

$
0
0

How do i Differentiate Between Master File Element and Reference File Element at same location of master and Reference file(Reference File attach in same location of Master file) in Microstation V8(Version 8) using MDL(C Programming)?

Connect 13 C# program

$
0
0

I can't get the justification to set in the text style, whether it is newly created or already exists in the file. The font, font height and width and char spacing set correctly, but not the justification.

C# program

using Bentley.DgnPlatformNET

        public static DgnTextStyle PopulateTextStyle(DPoint2d fontSize, double charSpacing, Int32 txtStyleJust, bool isBold)
        {
            DgnTextStyle dgnTextStyle = null;
            bool TagsTextStyleExists = false;
            TextStyleCollection textStyles = SheetManager.GetActiveDgnFile().GetTextStyles();
            foreach (DgnTextStyle aTxtStyle in textStyles)
                if (aTxtStyle.Name.Equals("TagsTextStyle"))
                {
                    TagsTextStyleExists = true;
                    dgnTextStyle = aTxtStyle;
                }

            if (!TagsTextStyleExists)
            {
                dgnTextStyle = new DgnTextStyle("TagsTextStyle", SheetManager.GetActiveDgnFile());
                dgnTextStyle.Add(SheetManager.GetActiveDgnFile());
            }

            DgnFont dgnFont = SheetManager.GetActiveDgnFile().GetDgnFontMap().FindFontByName(out uint foundNum, "CTFONT1", DgnFontFilterFlags.Resource);

            dgnTextStyle.SetFontProperty(TextStyleProperty.Font, dgnFont);
            dgnTextStyle.SetProperty(TextStyleProperty.Height, fontSize.X);
            dgnTextStyle.SetProperty(TextStyleProperty.Width, fontSize.Y);
            dgnTextStyle.SetProperty(TextStyleProperty.Justification, 7);   // CenterMiddle and/or CenterCenter
            dgnTextStyle.SetProperty(TextStyleProperty.InterCharSpacing, charSpacing);
            dgnTextStyle.Replace(dgnTextStyle.Name, SheetManager.GetActiveDgnFile());
            return dgnTextStyle;
        }

Donna Fanelli Rodrick

[CONNECT C++] DVec3d::IsParallelTo()

$
0
0

I'm attempting to check whether 2 DVec3d's are "parallel". I am not seeing a 'true' value returned as expected:

wprintf(L"cellAngle=%25.20f\n", cellAngle.AngleXY()*fc_180overpi);
wprintf(L"line tangent=%25.20f\n", tangent.AngleXY()*fc_180overpi);
wprintf(L"tangent.IsParallelTo(cellAngle) %d\n", tangent.IsParallelTo(cellAngle));

This is the output:

cellAngle=-149.99999999981395149007
line tangent=  30.00000000215948148252
tangent.IsParallelTo(cellAngle) 0

The Help file states "Tests if two vectors are parallel (opposites are considered parallel!)".

Returns "true if the vectors are parallel within tolerance"

Is there really a tolerance involved? 

[C# CONNECT] Add constraints to element

$
0
0

Hi all!

I have 3 elements. Shape "A", Shape "B" and Line "L".

I need create 2d constraint for them.

Example:

I finded classes for this task in namespace: Bentley.DgnPlatformNET.Constraint2d.

But I did not understand how use it.

Help me please.

Troubleshooting how and why are MVBA files saved when used?

$
0
0

Hi you all,

We have a lot of mvba files ( 36 ) wich are used by our engineers, 12 workstations, al the mvba on a network share. MVBA is used to create drawings, ad cells to drawings, and count cells in drawings and create a csv file with the cell counts, for processing.

All this works, rather well.

Yesterday I discovered, that the dates on the mvba files keep changing by itself, started digging and found out the directory wasn't write protected as it was on the former server we used, so I changed it so that only I can write in the directory, since I think there is nothing in the MVBA files that need saving.

Unfortunatly this causes microstation to complain at startup, because the first thing it seems to want to do when any vba is executed, is save all the vba files. This results in a popup stating it can't save a mvba and if you want to save somewere else. 36 times. These popups have been nown to occur before, but before the whole row popped up just twice, first row of pop ups after te first mvba is called, and the second row by trying to close microstation with the cross at the right top. Then after microstation was restarted everything works.

Now since the rights for the directory are set to read only, there are several, not all, pc's that keep complaining the mvba can't be saved, wile the others  just work

Could be a problem caused by the last or last before that update of Microstation ( were running V8i select 08.11.09.829 now) because all the mvba files used to be on a totally write protected server. Or perhaps have something to do with the way Microstation is installed, since most of the pc here are replaced ( there are new pc's with the problem, and also new pc's without the problem.)

So now the question is, is this a setting I can turn of, or is this caused by the MVBA? And if it is the vba, how do I troubleshoot this?

But given the fact all the pc's work with the same mvba, from the same directory, and not all the pc's have the problem I think it must be a setting somewhere.

 Any Idea's are greatly appreciated

Viewing all 7260 articles
Browse latest View live