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

RE: [CONNECT] Visual Studio Versions

$
0
0

Hi Jon,

[quote user="Jon Summers"]Should we be using Viz Studio 2015 for native code?[/quote]

From Bob's announcement: MicroStation CONNECT Edition MDL applications compiled with previous version of the SDK are both binary and source code compatible with this release. ... so Visual Studio 2013 is still required. I don't believe C++ compiler can be changed without breaking binary compatibility.

[quote user="Jon Summers"]MicroStation CONNECT Update 3 installs the Microsoft C++ runtime 2015 redistributable.[/quote]

Maybe it's a preparation for changes in future? From Bob's info: Update 4 will provide expected enhancements in a very near future update cycle release.

Visual Studio 2015 brings a lot of (and important) changes in C++ compiler, so it would be nice to move to this version, but I assume it's pretty complex change with external libraries and frameworks used internally in MicroStation.

With regards,

  Jan


[CONNECT] Visual Studio Versions

$
0
0

MicroStation CONNECT Update 3 installs the Microsoft C++ runtime 2015 redistributable.

As far as I know, we should be using Viz Studio 2013 for CONNECT C++ development.  Or am I mistaken?  Should we be using Viz Studio 2015 for native code?

RE: Catch and abort exit of Microstation

$
0
0

Please follow the MicroStation Programming forum best practices.

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?

The APIs supplied with MicroStation CONNECT are different to those supplied with MicroStation V8i. Consequently, our answers are likely to be different.

Identify Your Programming Language

It looks like you are writing MDL, correct?

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

Programming Forum

Please post MDL questions to the Programming Forum.

Catch and abort exit of Microstation

$
0
0

I have an mdl application where a user enters data in forms and on the drawing.  I am trying to find a way to catch the event when a person exits from Microstation using the X and prompt the user to save.  If the user picks cancel or cannot save due to data errors, I want to abort the exit of Microstation.  I can do this from the exit menu command but not when a user uses the X or closes from the task bar.

I have set a function for the SYSTEM_UNLOAD_PROGRAM event and with that I can catch the SYSTEM_TERMINATED_SHUTDOWN (-2) flag, but from what I've read, returning a non-zero value does nothing to prevent the unload.  If the flag is less than zero, the application cannot abort the unload.

I searched in Communities but could not find anything helpful.  I would seem that this is something that other people would need to do and perhaps I'm just missing something very obvious.

Any suggestions?

RE: Catch and abort exit of Microstation

$
0
0

Hi William,

I have no experience with such request, so my idea can be wrong completely: You can try to monitor input queue to check if X button generates any request sent to the queue (I guess it should, but not sure). In monitoring function you can reject this event, do what you need and to send the same event from your application.

It seems there is no documentation how monitoring function should be defined, but Jon provided this information in this older post.

With regards,

  Jan

RE: Catch and abort exit of Microstation

$
0
0

[quote user="William Wilson"]I am trying to find a way to catch the event when a person exits from Microstation using the X[/quote]

I think you may have to monitor Windows messages.  For example...

Search Forums that deal with Win32 API programming to find ways to disable the Windows close button or intercept the Windows message queue.

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0
Sorry to refresh such old topic, but i cant find the answer anywhere and this is the only trace there is.
Thing about notes they are treated as dimensions - and there is no method within .AsDimensionElement to .GetSubElements for enumeration like in cells. trying to treat a note .AsCellElement also brings up an error.
my macro needs to capitalize every letter in model text, textnode, dims etc.
///

If oElm.IsDimensionElement Then
Set enuDimElm = oElm.AsDimensionElement...... (here would be some get but there is none to choose from)

While enuDimElm.MoveNext
If enuDimElm.Current.IsTextNodeElement Then
Set oTxNodeElm = oenuDimElm.Current
Set enuText = oTxNode.AsTextNodeElement.GetSubElements
While enuText.MoveNext
Set oTxElm(n) = enuText.Current

'capitalize /rewrite etc sub call

Wend
End If
Wend

///
cant really tell where else this node could be stored.

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

[quote user="Michal Kurzewski"]Thing about notes they are treated as dimensions[/quote]

I see that you're using a rather old version of MicroStation (XM).  Perhaps Notes were different then?

If you key-in ANALYZE ELEMENT and select a note, what do you see?  Post a screenshot here.


RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

Hi Jon - thanks for quick reply. Actually i am using SS2, but the only mention of dealing with notes I found in this post. I dont think it changed at all because i got a very similar screenshot as you had.

i got If  for .IsCellElement before .IsDimensionElement and debugging shows the enumerated current is false for cell one, so its definitely treated as a dimension.

i am using fence as get elements for enumeration so I definitely picked whole note and only note for test.

cheers

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

Post Code: Easier than an Explanation

[quote user="Michal Kurzewski"]I got If  for .IsCellElement before .IsDimensionElement[/quote]

It's hard to explain code in a human language, but it's easy to read code.  Post a code snippet that shows what you are doing, and let us interpret it!

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

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0
If oElm.IsCellElement Then
'debugging shows its not cell element

ElseIf oElm.IsDimensionElement Then
Set enuDimElm = oElm.AsDimensionElement...... '(here would be some get method but there is none to choose from)

While enuDimElm.MoveNext

If enuDimElm.Current.IsTextNodeElement Then
Set oTxNodeElm = oenuDimElm.Current
Set enuText = oTxNode.AsTextNodeElement.GetSubElements
While enuText.MoveNext
Set oTxElm(n) = enuText.Current

'capitalize /rewrite etc sub call

Wend
End If
Wend

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

This works for me...

Public Sub Main()
    Dim id As DLong
    id = DLongFromLong(392159) ' Replace with ID of your note cell
    Dim oNote As CellElement
    Set oNote = ActiveModelReference.GetElementByID(id)
    AnalyseNote oNote
End Sub
Sub AnalyseNote(oNote As CellElement)
    Dim oComponents As ElementEnumerator
    Set oComponents = oNote.GetSubElements
    Do While oComponents.MoveNext
        Dim oCurrentElement As Element
        Set oCurrentElement = oComponents.Current
        Debug.Print "oCurrentElement type="; CStr(oCurrentElement.Type)
        If oCurrentElement.Type = msdElementTypeTextNode Then
            Dim oNode   As TextNodeElement
            Set oNode = oCurrentElement.AsTextNodeElement
            Dim word As Long
            For word = 0 To word = oNode.TextLinesCount
                Debug.Print "Text Node line " & CStr(word + 1) & ": " & oNode.TextLine(word + 1)
            Next word
        End If
    Loop

End Sub

Note the at ID is the ID of the cell in your note object.  The note's witness line and arrow are sort-of independent of the cell that contains the text node.  However, they all have the same graphic group number.

[CONNECT DgnPlatformAPI] .NET FrameWork upgrade error

$
0
0

I opened one of the example .NET solutions delivered with the SDK (for Update 3) using Viz Studio 2013.  The IDE works fine, and can build the project except for errors about the .NET Framework version.  Viz Studio tells me that the example is .NET Framework 4.0 but MicroStation is built using .NET Framework 4.5.

No problem!  I say to myself: let's simply upgrade that project to 4.5.  But the fates plot against me (or, at least, Microsoft plots against me).  On attempting to upgrade the project's Framework I get this obstacle to progress...

Why doesn't Viz Studio complain about the Framework version when I build the project from the SDK shell?

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0
That would work fine, if not that there are alot of notes in the model and its also meant for batch - so there would be more - manual ID readouts are really not an option. how to get ID of each note? i still cant enumerate trough elements in dimension as i would cell.

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

[quote user="Michal Kurzewski"]How to get ID of each note?[/quote]

It's a common idiom when demonstrating a feature of VBA to provide an element ID.  In real code you would not do that.

[quote user="Michal Kurzewski"]There are alot of notes in the model and its also meant for batch[/quote]

The scanner is your friend!  Create an ElementScanCriteria object, set its properties, then use ModelReference.Scan to find elements that match the criteria. 

VBA Help

There are examples in MicroStation VBA help and here.



RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

Ok - you got me there.
I have put my question incorrectly.

how to get ID of Cell within Note then (with VBA and not manually)?

ElementScanCriteria is not an option as it would just return notes or notes IDs. its the enumeration elements IDs within notes i need - cells Ids for that occasion - which simple scan wont cover.

and yea i can use "help" thanks ;) - i am busting my F1 and F2 and googling out and debugging a lot before posting any question.

RE: [XM VBA] Accessing Dimension Note in VBA

$
0
0

[quote user="Michal Kurzewski"] ElementScanCriteria is not an option[/quote]

How else are you going to examine every element in your DGN model?

[quote user="Michal Kurzewski"]Its the enumeration elements IDs within notes I need[/quote]

You're iterating two sets of data...

  1. Each interesting element (note) in a DGN model using the scanner
  2. For each note...
    1. Each text string in a text node in a note cell using the text node's enumerator (or just use the text node indexer as in my example)

[XM VBA] Accessing Dimension Note in VBA

$
0
0

I'm looking for someone who has had any success in accessing a "NOTE" in VBA. When selecting a note with  a leader in the MicroStation GUI, it shows in the information window as a Dimension and a Note. For the life of me, I cannot figure out how to access the text that makes up the note. I saw some code in this forum that created a dimension note but it gave me no real insight as to how to, programmatically access the text.

Any assistance would be greatly appreciated.

[V8i C#] Disabling Annotation Scale on Text Elements

$
0
0

There was a thread a few years back about how to toggle the annotation scale setting off on text elements ([View:http://communities.bentley.com/products/programming/microstation_programming/f/19570/t/72781:940:0])

The solution mentioned in the thread was not very reliable and the thread is locked. Anyways,  this seems to be working well for me and I thought I would share.  If anyone else has any other solutions, please post :)

public static void DisableAnnotation(this Element elem, bool rewrite = false)
        {
            DataBlock[] data = elem.GetUserAttributeData(32980);
            if (data.Length > 0)
            {
                // Set appropriate flags.. Use Keyin "Analyze Element" to examine attributes.
                data[0].Offset = 7;
                byte flag1 = 0;
                data[0].CopyByte(ref flag1, true);

                data[0].Offset = 25;
                short flag2 = 2604;
                data[0].CopyInteger(ref flag2, true);

                elem.DeleteUserAttributeData(32980, 0);
                elem.AddUserAttributeData(32980, data[0]);

                // Delete the annotation meta data...
                DataBlock[] data2 = elem.GetUserAttributeData(22259);
                if (data2.Length > 0)
                    elem.DeleteUserAttributeData(22259, 0);

            }

            if (rewrite)
                elem.Rewrite();

        }

How to download Microstation SDK for Microstation V8i(SS3)?

$
0
0

Dear all,

I am installed microstation V8i(ss3) i need SDK for developement i dont know how to get it any one give me the link for download it.

Thanks & Regards,

Karthik M

Viewing all 7260 articles
Browse latest View live


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