Hi all,
I am making a lot of sheet setups, with varying scaled references. I have text elements with information in my model. Using the reference dialog manual toggles, I can activate the "Use Active Annotation Scale" to get the text to display at precisely the correct scale regardless of the reference scale. That is Awesome!
How do I toggle the "Use Annotation scale" on a reference? (using vba obviously)
Thanks,Torben
Please, how do I toggle this value?
Thanks,/Torben
System: Win7 64bit 16GB Ram - microStation V8i SS3 08.11.09.578. + PoinTools CONNECT. - Intel i7-4800MQ CPU@2.70GHz, 4 core / 8 Logic proc.
Update: Nothing revealed using the PropertyHandler method and GetAccessStrings... nothing I tell you.
No keyin or vba in the uStation manual (Reference Attachment Settings dialog)
help
Ok. Got it..
I needed to have the sheet ACTIVE, then reference the attachment by element ID.
I then got a bunch of other props, just as if I had selected the attachment!
I wish it just worked with a variablereference to the attachment even though it is in another (sheet)model, as the flickering as a result of going back and forth between model and sheets looks amateurish to say the least... sigh
Hi Torben, I also wish to do this and couldn't find any helpful information.
Do you have VBA code for this that you would be willing to send me please?
The MicroStation VBA object model does not currently provide a way to set reference attachment model propery to UseAnnotationScale. Below is some VBA code that calls MDL to set reference the reference attachment use annotation properly. Simply pass a complete or partial reference file name; where a partial file name performs a wild card search of matching attachments, and if you want UseAnnotationScale set to True or False.
' ModelReference - annotation parameters Declare Function mdlRefFile_getParameters Lib "stdmdlbltin.dll" (name As Long, ByVal paramName As Long, ByVal modelRef As Long) As Long Declare Function mdlRefFile_setParameters Lib "stdmdlbltin.dll" (ByVal param As Long, ByVal paramName As Long, ByVal modelRef As Long) As Long Sub ModelReferenceSetAnnotationScale_TEST() ModelReferenceSetAnnotationScale "Ref1", True End Sub Sub ModelReferenceSetAnnotationScale(sRefFileName As String, bEnabled As Boolean) Dim oRef As Attachment Dim lUseAnnotationScale As Long Dim rtc As Long ' Iterate through ModelReference attachments For Each oRef In ActiveModelReference.Attachments ' Handle missing file case If oRef.IsMissingFile Then Debug.Print "Missing File: " & oRef.DesignFile.FullName Exit Sub End If ' Process valid file If oRef.DesignFile.FullName Like "*" & sRefFileName & "*" Then Debug.Print "Request to modify Annotation Scale for: " & oRef.DesignFile.FullName ' Get annotation scale current value rtc = mdlRefFile_getParameters(lUseAnnotationScale, REFERENCE_USEANNOTATIONSCALE, oRef.MdlModelRefP) If CBool(lUseAnnotationScale) = bEnabled Then Debug.Print "No need to modify Attachment. UseAnnotationScale currently set to: " & bEnabled Exit Sub Else ' Set annotation scale desired value Debug.Print "Previous UseAnnotationScale: " & CBool(lUseAnnotationScale) & ", Status: " & rtc lUseAnnotationScale = CLng(bEnabled) rtc = mdlRefFile_setParameters(lUseAnnotationScale, REFERENCE_USEANNOTATIONSCALE, oRef.MdlModelRefP) Debug.Print "Setting UseAnnotationScale: " & CBool(lUseAnnotationScale) & ", Status: " & rtc oRef.Rewrite End If End If Next End Sub
FYI. A community member pointed out that they had trouble locating the value for REFERENCE_USEANNOTATIONSCALE macro above. This macro can be located in the MDL SDK mdl.h header file as:
#define REFERENCE_USEANNOTATIONSCALE 71
Hi,
with the migration to CONNECT Edition the functions mdlRefFile_getParameters and mdlRefFile_setParameters were replaced by a set of new type dedicated functions like mdlRefFile_getBooleanParameters and mdlRefFile_setBooleanParameters.The following Code example could be an example of migration to CONNECT Edition:
Option Explicit ' ModelReference - annotation parameters Const REFERENCE_USEANNOTATIONSCALE = 71 Declare PtrSafe Function mdlRefFile_getBooleanParameters Lib "stdmdlbltin.dll" (ByRef value As Long, ByVal paramName As Long, ByVal modelRef As LongPtr) As Long Declare PtrSafe Function mdlRefFile_setBooleanParameters Lib "stdmdlbltin.dll" (ByVal value As Long, ByVal paramName As Long, ByVal modelRef As LongPtr) As Long Sub ModelReferenceSetAnnotationScale_TEST() ModelReferenceSetAnnotationScale "Ref", True End Sub Sub ModelReferenceSetAnnotationScale(sRefFileName As String, bEnabled As Boolean) Dim oRef As Attachment Dim lUseAnnotationScale As Long Dim rtc As Long ' Iterate through ModelReference attachments For Each oRef In ActiveModelReference.Attachments ' Handle missing file case If oRef.IsMissingFile Then Debug.Print "Missing File: " & oRef.DesignFile.FullName Exit Sub End If ' Process valid file If oRef.DesignFile.FullName Like "*" & sRefFileName & "*" Then Debug.Print "Request to modify Annotation Scale for: " & oRef.DesignFile.FullName ' Get annotation scale current value rtc = mdlRefFile_getBooleanParameters(lUseAnnotationScale, REFERENCE_USEANNOTATIONSCALE, oRef.MdlModelRefP) If CBool(lUseAnnotationScale) = bEnabled Then Debug.Print "No need to modify Attachment. UseAnnotationScale currently set to: " & bEnabled Else ' Set annotation scale desired value Debug.Print "Previous UseAnnotationScale: " & CBool(lUseAnnotationScale) & ", Status: " & rtc lUseAnnotationScale = CLng(bEnabled) rtc = mdlRefFile_setBooleanParameters(lUseAnnotationScale, REFERENCE_USEANNOTATIONSCALE, oRef.MdlModelRefP) Debug.Print "Setting UseAnnotationScale: " & CBool(lUseAnnotationScale) & ", Status: " & rtc oRef.Rewrite End If End If Next End Sub
Best regards,
Artur