Preventing of attach the same model from the same design file, what is already attached by MSTN-Connect 10 Update 14 via VBA as it was in MSTN 8i with error -2147220766.

Dear all,

i'am setting my Attachments with a Command:

Set oReferenz = oReferenzen.AddCoincident1(RefFile, "", "", "", msdAddAttachmentFlagCoincidentWorld)

In MSTN 8i was tested whether a Reffile is already attached. In this case i've got oReferenz is Nothing and  a Error -2147220766.
In a MSTN Connect i am getting a same Attachment with a Suffix Ref, without any Errors.

My Standardsetting for Loading of Attachments is: MS_REF_DEFAULTSETTINGS=display=1,snap=1,locate=1,treatAsElement=0,trueScale=1,useLights=0,saveRelativePath=0,scaleLineStyles=1,ignoreWhenNesting=0,displayRasterRefs=0,newLevelDisplay=fromconfig,nestMode=none,nestDepth=1,nestOverrides=allow,useAnnotationscale=1,plotAs3D=0 

How can i prevent of attach the same attachment (which means the same model from the same design file) what is already attached in MSTN Connect?

Thank you.

Parents Reply
  • IN EXTREMELY I WILL SOLVE THIS THROUGH COLLECTION AND COMPARISON OF FILES.

    In my opinion it is the only way how to write correct code.

    I do not understand why the problem of unique logical names is discussed so widely when it does not solve anything, because does not allow to implement robust code to test whether the same model is attached or not.

    It's not the role of logical names and such code is useless, because it works only when (weak) assumption, that existing attachment has no logical name assigned, is true. When a model will be attached with logical name assigned, to attach the same model with empty logical name will (I guess) work fine and the model will be attached.

    but why it was succeed in MSTN 8i and now in MSTN CE not?

    My experience is that when VBA code from V8i is correct and clean, it runs fine (nearly) always in CE.

    When problems appear, I have seen so far these sources of problems:

    • Unfortunately, VBA is still pretty buggy, so from time to time new bug is discovered. But usually it's simple to analyze it and confirm it's bug, not feature.
    • MicroStation CE is more strict in many operations, so the same operation cannot be done in CE. But it's quite rare.
    • "code on edge", based on strange assumptions, not robust enough, or using "it's not documented, but it works, even when I do not why" approach, produces errors in CE. Even when it's still VBA, it's the transition from version 6.3 to 7.1 and from 32bit to 64bits, so many things internally changed. I saw similar problems also when C code from /J (MDL) or V8i (VS2005) is ported to more strict and enhanced VS2017 compiler ... what worked in the past cannot be compiled now, or produces many warnings, or runs, but crashes often.

    With regards,

      Jan

Children
No Data