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

Example MsgBox with a Prompt, yesNoCancel [Title]

$
0
0

I have tried over and over to put together a working Message box

Dim Prompt As String, Tilte As String, Status As String, Status2 As String
Dim Buttons As Integer

Prompt = "Welcome to Learning 5"
Title = "Unload File Check"
Status = "Was Unloaded"
Status2 = "File NOT Unloaded"
Buttons = vbOKOnly + vbCancel
MsgBox (Prompt)

I got this far, the Prompt shows the "Welcome to Learning 5"

Every time I tried adding second line of text with the & vbCrLf & Status got an error, I tried the "Status", I tried [Status]

If I just did (prompt + Status it worked but a mess, wanted two lines, plus I wanted the vbYesNoCancel buttons to pop-Up and I wanted a Title for the box

Anyway I called myself searching various ways

MsgBox Examples, Examples of MsgBox Function. Found a lot on Excel on-line but could not seem to make a working one for a starting point.

Jan gave me an example of Macro using variable and I was able to follow the working format on that. I keep looking for a working example

to learn from. Someone please help? No Will someone help me

This also was a failure MsgBox "Test Message Wanted" & CStr(This), vbOKOnly, + CrLf "Check"


Read Raster references File reference in C# Microstation Connect Edition Update 11

$
0
0

Hi there,

I am looking for an object that will have both xrefs and raster references 

Currently, I am using this code to loop through the references for parent dgn file-

Bentley.Interop.MicroStationDGN.Attachment attachment1 in attachments, here attachments is Bentley.Interop.MicroStationDGN.Attachments( parameter of function) which is called with Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp.ActiveModelReference.Attachments

It returns me only xrefs not raster reference.

I have used the below code to read raster references 

foreach (Bentley.Interop.MicroStationDGN.Raster raster in Rasters)
{

...

}

and Rasters is Bentley.Interop.MicroStationDGN.Rasters which is function parameter called with BMI.Utilities.ComApp.RasterManager.Rasters, the problem I am facing with this code, 

It gives me all the available raster references of the main parent file, my requirement is to read -

Suppose child1 has raster1 as raster reference and child2 has raster2 as raster reference I should be able to read it in this way only, could you please suggest which object will have both xref and raster references?

MicroStation Error - Only one user

$
0
0

Hi, was wondering if anyone else had run into this error and how they resolved it? It is only occurring for one user in our company which is strange, so apparently it has something to do with their C drive. Have already tried updating his ActiveX file (MSCOMCTL.OCX) and still receive the error below. Any suggestions  would be much appreciated. Thanks

Compile Error in hidden module: frmQuickSetPlotForm1

Is there a way to get an image of an object using VBA in Microstation?

$
0
0

I'm using V8i SS4, SS10 or Connect, and I'm wondering if there's a way to get an image of an object, or an image of an area of a drawing? Or can the View object provide an image output? so if i zoom into an area that it can provide an image of what's being displayed.

Thanks.

how to export a dwg file to fbx with C#?thanks

$
0
0

I have some dwg models, and I want to convert them to common format like fbx, then How can I solve it with C#? thanks

[CONNECT C#] Visual Studio Debuging Microstation - try{...}catch(...) doesn't catch the error

$
0
0

I'm switching C# development from Microstation V8i to Connect.
Using Visual Studio 2017 Enterprise edition, Framework 4.6.1, Microstation Connect Update 12.

As C# Connect is much different to C# V8i, I#m getting a lot of Exceptions.

Unfortunatelly, any exception will make Microstation crash, even if I  use try/catch

try
            {
                throw new NotImplementedException();
            }
            catch (Exception Ex)
            {

                //do something
            }

Are there any settings in Visual Studio that will catch this?

Is there a way a vba or macro run on dgn open, specifically verifying ActiveDesignFile Path

$
0
0

I am using the OpenClose Event Handler and I want to run automation on if the wrong PCF is being used but at the time this runs there is no ActiveDesignFile to check against.  Any ideas on how to run a macro or vba once the dgn opens in Power GEOPAK SS4.  I have already tried MS_DGNAPPS and read the article from 2012.  No luck.

Thank you

[MDL C/C++ MicroStation V8i AECOsim SS6] MstnButtonEvent::GetPoint() from MstnPrimitiveTool has different behaviour.

$
0
0

Hello everyone!


I have developed a place function, deducted from MstnPrimitiveTool. Now a customer complains this function has an unexpected tolerance of a few millimeters from the snappoint.
I had created this function under MicroStation V8i and this is independent from SSx.
After analyzing I found the different behavior here:

            bool PrimitivToolShelfPlaceFree::OnDataButton(MstnButtonEventCP ev)
            {
                  ___ABLOG_VALUE(0, ev->GetCoordSource(), "GetCoordSource");
                  // abDbg_placePointInDgn(VP_VOHU, *(ev->GetRawPoint()), 0.5 * TO_UNIT, L"R", L"RAW", false);
                  *_pFixPoint = *(ev->GetPoint());
                  // abDbg_placePointInDgn(VP_VOHU, *_pFixPoint, 0.5 * TO_UNIT, L"F", L"FIX", false);
               return (true);
            }

abDbg_placePointInDgn()” Just adds a circle to the dgn, because it is easier to see, then to read some coordinates.
I Work with the same scenario. Same DGN, same clicks, … (Of course, I tried first with different DGNs, configuration, etc., but nothing changed this behavior)


In MicroStation V8i:
GetCoordSource is CoordSource::FROM_ElemSnap (check)
GetRawPoint() the MousePoint (check)
GetPoint() the snapped Point (check)


But in AECOsim SS6 (compiled with buildingdesignersdk):
GetCoordSource is CoordSource::FROM_User (fail!)
GetRawPoint() the mouse-point (check)
GetPoint() something near the mouse-point (fail!)

My Question: Is this a bug? Or exist there somewhere a well hidden configuration, method, etc. so GetPoint() will return as promised in the headerfile: “ //! Get the location of the cursor for this event in active coordinates. The point has already been adjusted for locks and snaps.”


How to change "surface normal" for all solids and surfaces in the design file. I am trying to do this using VBA macro.

$
0
0

How to change "surface normal" for all solids and surfaces in the design file. I am trying to do this using VBA macro.

Bentley Service Request 7000946376

[V8i] How to change a text field to normal text? Is this possible with VBA?

$
0
0

I've been asked to change all of the text fields in a DGN file to plain text (the same characters, just not a field).

This SOUNDS like it would be easy - extract the string of the text element (which would include the field), reassign that string to the text element, then rewrite/redraw the element, move next. Easy enough for a simple VBA macro...

I don't want to get too far into this is the task is NOT that easy. What DON'T I know that will get in my way?
Thank you.
MaryB

[V8i VBA] While looping through an enumerator, can I delete Enum.Current and replace with another element?

$
0
0

Again, let me ask before I go too far down this road.

I've been able to convert all my text nodes with fields to single-line text nodes. Works great (Thanks to Jan!)

So for thinking...

Can I loop through an enumerator of single line text nodes, and change them to text elements?
This could be done a few different ways...
My concern is that something weird would go on if I were While...Wend-ing through my enumerator, if I do something to Enumerator.Current to change the element type, does that mess up the enumerator process at all?
I mean, if Enumerator.Current is a text node, but then I Drop it to a text element, does that have any effect on what has been or is enumerated? The text element didn't exist when the enumerator was put together, and the text node that was part of the enumerator doesn't exist anymore...

Or am I thinking too hard?
Thank you.

MaryB
MSTN 08.11.09.829

[CONNECT NET] Element snappable property

$
0
0

Hello everyone,

How can I obtain and modify the snappable property of the elements of Microstation CONNECT from C #?

many thanks,

[V8i VBA] Is there a way to Create a Note element?

$
0
0

As I read through the Help, There seems to be precious little to be found for Note elements. I can change the settings in the dimension style all I want, but I don't see any way to do anything else with them.

I'd like to be able to select a piece of text/textnode and use that to create a note. I don't need the text editor window - I just want whatever text is selected to "become" the note.

Is that beyond the scope/ability of VBA for V8i?
Do I need to dig up one of those MDL wrapper-things? Could you please point me in the right direction for that?

Thank you.
MaryB
MSTN 08.11.09.829

[Connect VBA] Text justification and origin

$
0
0

We have an application that works both on MicroStation and PowerDraft. Most of the code is in C#. VBA or MDL code mainly contains code that extract information from drawing or code that draw elements.

From what I understand, MicroStation Connect has been modified to allow user to change text justification without moving the text because some users asked for it. The problem is that a lot of my VBA code now does not work as expected. Since VBA has origin property only which is the origin computed by MicroStation after changing alignment. In MDL there is userOrigin which is the real one. Another problem is that if I want to draw a text in VBA with some spaces before it so the text is not too near its associated symbol, spaces are ignored. Texts are inserted like there's no space. These changes cause these texts to be no longer usable to snap on them and these texts are my point numbers.

I have succeeded in correcting some functions by computing vertical and horizontal corrections myself. I'm am doing the opposite of the recalculation by MicroStation. That's completely ridiculous and these texts are no longer inserted at their real position.

My next idea is to call MDL from VBA (mdlText_extract, mdlText_create) but these functions are now obsolete according to header files. They recommend using the new TextBlock API which is not available in VBA. And I will have to declare a lot of structures and function prototypes to do this. It will be a lot of pain.

What should I do exactly ? What was Bentley thinking exactly ?

[V8i VBA] Any App to edit MVBA modules outside of MicroStation?

$
0
0

I am about to embark on a several day project of raster modification. This is going to take a lot of processing, so I will have a lot of down time.

I may not want to run MicroStation to keep my computer resource usage down, but this would be a great time for me to work on some of my half-finished macros while I'm waiting for the rasters to chug through. Is there any way I can edit my MVBA projects outside of MicroStation?

I love the MicroStation VBA editor because of the "predictive text"-type way it offers me the applicable methods and properties - it helps me make sure I'm not mis-typing anything, or trying to apply a method that doesn't exist. Is there any way to get that kind of interactivity with any other editor?
Thank you.
MaryB


OS Could not load .dll, error 126.

$
0
0

Hello,

I have a custom add-in for Microstation Select Series 4. I had this .dll working before in my older dev machine. Then, I upgraded to SS10 and I was still able to run my custom add-in. However, I got a brand new machine. Proceeded to do a clean install of SS10 but I get the following error when launching my command. I wonder since it s a bran new machine, if there are any settings I missed during the installation. It seems odd to me that the same installer for my custom plug in failed in a clean environment. Any thoughts would be appreciated.

Thanks in advance,

Caleb

Timer() Code failure

$
0
0

I have read a lot of questions, I have also taken advice on the Goggle the question and spent hours trying to get a simple timer

I tried using the Timer() feature but Debug does not like what I have . I called myself copying it correct I had even tried making a Dim Timer just in case.

Will anyone help me figure this out? Please See below tried to paste in the error message received and I read the help on it but still do not know what is wrong

Type mismatch (Error 13) 

is where is read?

Sub PauseCodeOld1()
Dim Start As Single ' Snapshot of when timer started
Dim Elapsed As Single ' Total time elapsed
Dim Pausetime As Single ' Desired duration in seconds
Dim TimerTemp As Single ' store current value of Timer function
Dim Timer() As Single ' Added trying to stop the Subscript out of range (Error9)
' modified to as Single 081619
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
Pausetime = 5 ' Set duration.
'MsgBox ("Time Now " & Results)

' Store current Timer value
' Timer is a VBA function that Returns a Single representing
' the number of seconds elapsed since midnight.
Start = Timer()

Do ' Begin a Do While Loop
DoEvents ' Yield to other processes and waste time.

' Calculate elapsed time
' Get current value of Timer function
TimerTemp = Timer
' Calculate how many seconds have elapsed between now and Start
Elapsed = TimerTemp - Start
Debug.Print "Elapsed: " & CStr(Elapsed)

' Determine if the Elapsed time is greater than desired pause time
' If not, then repeat loop
Loop While Elapsed <= Pausetime

MsgBox "Paused for " & CStr(Elapsed) & " seconds"
End If
End Sub

This was the error, not sure if you can ready what is says Compile Error: Type Mismatch

[CONNECT VBA] Projects loaded before file is opened

$
0
0

Hi,

It seems that MicroStation loads the VBA project connected to the last WorkSet loaded even before any file is opened.

I have a VBA project in WorkSet A that hooks into file open/close events. When I start CONNECT, it remembers the last WorkSpace/WorkSet that was used (in this case WorkSet A) and it is pre-selected in the backstage. If I select some other WorkSpace/WorkSet and open a file the code connected to the file open/close event from WorkSet A is still executed.

This makes it impossible to switch between different WorkSpaces/WorkSets that has VBA-code containing event hooks.

Regards,

Krister

Microstation CONNECT; mdl; text node element

$
0
0

Hi,

I have tried every possible method in Microstation API to extract text from TextBlock created from a text node element, but all I get is a empty string.   I looked at the example code in Microstation API help under mdlTextNode_extract.

ElementHandle eh (...);
TextBlockPtr textBlock = TextHandlerBase::GetFirstTextPartValue (eh);
WString string = textBlock->ToString ();
The string above is empty!!!!
I also tried the following methods:
caret->GetCurrentRunCP()
caret->MoveToNextCharacter,()
caret->MoveToNextParagraph ()
caret->MoveToNextField()
but I still can't get the text string in a text node. Can someone tell me how to extract text string from a text node.
There should be more documentation on TextBlock.  It is difficult to understand the various components of a text block like TextBlockProperties, TextField, ParaGraphProperties, RunProperties, etc.

Thanks.

[CE U12] Polyface in C#

$
0
0

Hi all,

I see that in C++ I could extract info like polyface vertex/index arrays in this way:

status = mdlMesh_getPolyfaceArraysExt(inEdP1, &pArrays0, &pNumPerFace0, NULL, NULL, NULL, NULL, NULL, false);

mdlPop_polyBrepFromElementDescrEx(&pBrep0, pContext, &pArrays0, pNumPerFace0, &color0, false, false);

Is there a C# counterpart for this operation?

I wasn't able to find it.

Thanks.

Viewing all 7260 articles
Browse latest View live


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