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

V8i - InRoads (SS2/SS4) VBA Help?

$
0
0

Where could I find the documentation for any classes/objects/methods/etc. for accessing InRoads via VBA? Is there such a thing?

Thank you.


[CONNECT C++] Install Viz Studio 2015 with all C++ Features

$
0
0

As I learned recently, installing a default Viz Studio 2015 does not install all C++ features.  You have explicitly to select them.  If that surprises you (it did me) then visit discussion groups that deal with Viz Studio to read plenty of posts about that.

Robert Hook pointed out here that while installing Viz Studio 2015 we need to choose Windows and Web Development | Universal Windows App Development Tools.  That advice may not be clear, so I took a few screenshots...

RE: V8i - InRoads (SS2/SS4) VBA Help?

$
0
0
Full disclosure - I'm using Power InRoads...I don't have that file available to me (or at least, not at that location).

That's a shame! I really liked the way that Geopak was accessible from VBA. So not only does InRoads not have my favorite tools, there's no way for me to recreate them?
*bummer*

Thanks for letting me know!

RE: V8i - InRoads (SS2/SS4) VBA Help?

RE: [V8i C++/C#] Native MDL and ProStructures

$
0
0

[quote user="Jon Summers"]I'm biased because I choose not to develop for MicroStation V8i using C#.[/quote]

Well, I have to confess I was more "forced to choose" than I choose it ;-)

But both for V8i and CONNECT Edition I consider to use both C# and C++ (with C++/CLI as a glue between both worlds) as the best solution, even though the code and architecture is usually a bit complex:

  • C# allows to implement GUI (WinForms or WPF) and provides better localization options
  • C/C++ is still the most powerfull MicroStation API, so no upfront analysis "is managed API enough for our requirements" is required.
  • Split to layers and the necessity to define how they will communicate through C++/CLI wrapper requires extra time (and I still think I am not good enough in this task), but at the same time it leads to better and clearer application internal structure.

Regards,

  Jan

请问如何获取“材质/面连接”的材质id

$
0
0

用 “查询材料” 命令可以查到 “智能实体面包含材料****",但是用 mdlMaterial_getInternalAttachedMaterialElementId、mdlMaterial_getExternalMaterialAttachment 都无法获得材质信息。请问有没有办法可以取到这种情况的材质信息?附件是一个测试样例,谢谢![View:/cfs-file/__key/communityserver-discussions-components-files/343173/t26_2D00_4.dgn:940:0]

RE: [V8i C++/C#] Native MDL and ProStructures

$
0
0

Hi Nick,

Per Jon and Jan's recommendation, C++/CLI is likely the most efficient and effective way to bridge your calls between native and managed code APIs.

ProStructures .NET Add-ins (ProSteel and ProConcrete, Assembly: ProstructuresNet.dll) can leverage any MicroStation APIs (MDL: C/C++ Native and .NET Managed, or MicroStation VBA), along with any Microsoft APIs required.  A couple useful links for ProStructures related Programming resources currently include:

HTH,
Bob

RE: 请问如何获取“材质/面连接”的材质id

$
0
0
In the case of this solid, there isn't a single material attached to the entire element which is why mdlMaterial_getInternalAttachedMaterialElementId and mdlMaterial_getExternalMaterialAttachment didn't work for you. Here the material has been attached to each individual face of the solid. I don't believe there is a published mdlKISolid_ function in V8i that will let you extract the face material attachment information.

HTH

-B

RE: Using a MACRO to change specific reference file logical names

$
0
0

Thank you for this. What determines the default logical name of the files?

I am using Microstation through a specific DOT user and i'm not sure if the default logical names are stored anywhere. In order to run a macro I have to open the files in a nonDOT user microstation (default).

From your post i made this:

Sub SetLogNameAsDefLogName()

   Dim att As Attachment

   For Each att In ActiveModelReference.Attachments

       If att.AttachName <> "0014132SIGN.dgn" Then

          att.LogicalName = "SIGN"

          att.Rewrite

       End If

   Next

End Sub

But it changes every reference to logical name SIGN. Is there a way to do this for every specific reference file listed below (logical names are correct in picture)?

RE: Using a MACRO to change specific reference file logical names

$
0
0

Hi Taylor,

[quote user="Taylor Brownlow"]Is there a way to do this for every specific reference file listed below (logical names are correct in picture)?[/quote]

Probably yes, but you still have not defined any rules how the logical names should be changed. With all respect, the picture is not any definition.

I have to repeat my question posted earlier: Is the rule about to remove (strip) all numbers from a file name beginning and the remaining part to change to uppercase?

With regards,

  Jan

RE: Using a MACRO to change specific reference file logical names

$
0
0
Sorry, yes. to go from file name 123456SIGN.dgn to logical name SIGN or 123456sign.dgn to logical name SIGN.

RE: Using a MACRO to change specific reference file logical names

$
0
0

This will check for blank logical names and replace them with the last four characters of the base filename (no extension). 

Sub SetLogNameAsDefLogName()
   Dim att As Attachment
   Dim NewLogicalName As String
   For Each att In ActiveModelReference.Attachments
       NewLogicalName  = Left(att.AttachName, Len(att.AttachName)-4)
       If att.LogicalName <> "" Then
           att.LogicalName = NewLogicalName
           att.Rewrite
       End If
    Next att
End Sub

You could add aditional tests, too.

RE: Using a MACRO to change specific reference file logical names

$
0
0

Wow great that's what I had in mind but it includes the whole file path as shown below. I understand that the -4 in the code is to get rid of the .dgn. How would I specify the left bound?

RE: Using a MACRO to change specific reference file logical names

$
0
0

Hi Taylor,

in my opinion Chuck's code is not robust enough, because it works for 4 characters after the digits only, which has not been defined it will be always true.

You can adapt this example to have flexible and robust code. The first function remove all leading numbers, the second one converts all characaters in string to uppercase.

Private Function StripLeadingNumbers(inputText As String) As String
    Dim textLength As Long
    textLength = Len(inputText)

    Dim position As Long
    For position = 1 To textLength
        If Not IsNumeric(Mid(inputText, position, 1)) Then
            Exit For
        End If
    Next

    StripLeadingNumbers = Mid(inputText, position, textLength - position + 1)
End Function

Private Function ConvertToUpperCase(inputText As String) As String
    ConvertToUpperCase = UCase(inputText)
End Function

Public Sub ExampleStripAndConvert()
    Dim text As String
    text = "314159268MyReferenceFile"

    Dim outputText As String
    outputText = StripLeadingNumbers(text)
    outputText = ConvertToUpperCase(outputText)

    MsgBox "Striped and uppercased: " & outputText
End Sub

With regards,

 Jan

RE: Using a MACRO to change specific reference file logical names

$
0
0

Sorry, but I only updated your code, no testing was performed.

Sometimes, once you have the MicroStation VBA part working, Google is the best way to get "generic" VBA help.

I found this link is a few seconds: http://vba-tutorial.com/parsing-a-file-string-into-path-filename-and-extension/

The other part would be to get rid of the project number portion of the file name. That would be a Right(NewLogicalName, 4), except for an extra test to see if that returns YOUT, which means your filename contains SHEETLAYOUT and would need to use an 11 instead of a 4.

If your project numbers are always 7 characters, you could use Len(NewLogicalName)-7 to get the length of the string needed for the Right function.


RE: Using a MACRO to change specific reference file logical names

$
0
0

I like Jan's addition. He clearly spent more time looking at this.

As long as you are updating reference attachments, you might want to consider updating reference file descriptions as well.

That would require a multiple test (See Select Case ... End Select) where once you know the upper case logical name, test it against a list of known logical names and revise the reference file description to correspond with that file type.

In for a penny, in for a pound, as they say.

RE: Using a MACRO to change specific reference file logical names

$
0
0

I forgot to remove the file extension, so one extra function is required:

Private Function StripLeadingNumbers(inputText As String) As String
    Dim textLength As Long
    textLength = Len(inputText)

    Dim position As Long
    For position = 1 To textLength
        If Not IsNumeric(Mid(inputText, position, 1)) Then
            Exit For
        End If
    Next

    StripLeadingNumbers = Mid(inputText, position, textLength - position + 1)
End Function

Private Function ConvertToUpperCase(inputText As String) As String
    ConvertToUpperCase = UCase(inputText)
End Function

Private Function RemoveFileExtension(inputText As String) As String
    RemoveFileExtension = Mid(inputText, 1, Len(inputText) - 4)
End Function

Public Sub ExampleStripAndConvert()
    Dim text As String
    text = "314159268MyReference.dgn"

    Dim outputText As String
    outputText = StripLeadingNumbers(text)
    outputText = RemoveFileExtension(outputText)
    outputText = ConvertToUpperCase(outputText)

    MsgBox "Striped and uppercased: " & outputText
End Sub

With regards,

  Jan

[CONNECT C++] How to change a line of text into a text node

$
0
0

I'm attempting to update text on a drawing using an old "company" .rsc font into a TrueType  font. I have a few instances where we have used "special" symbols assigned to locations in the .rsc file (e.g. a "Working Plane" symbol). I (think) I can "convert" this symbol by building a text node with the "components" of the symbol, and providing the origins for the various pieces. If I have a single part TextBlock, does inserting/appending a LineBreak "convert" the text into a Text Node?

RE: Using a MACRO to change specific reference file logical names

$
0
0

Thank you Jan! I run the macro, replacing "myreference" with the real file. Am i to add the previous logical name code?

RE: Using a MACRO to change specific reference file logical names

$
0
0

Hi Taylor,

[quote user="Taylor Brownlow"]I run the macro, replacing "myreference" with the real file. Am i to add the previous logical name code?[/quote]

my code is an example how to manipulate with strings (strip leading numbers, remove last 4 chars, capitalize). I thought it's obvious it's now your responsibility to use these functions in your code. In my opinion nothing in my code should be changed, the functions are ready to be used, the main sub is only necessary minimum to deonstrate how the functions work.

With regards,

  Jan

Viewing all 7260 articles
Browse latest View live


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