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

Detecting a Cached Saved View Attachment in MicroStation CONNECT

$
0
0

Hi All,

I have some legacy VBA code from v8i that I'm trying to port over to the CONNECT versions - it's using a CExpression with a pointer into the referenceFile struct for a specific reference:

Private Declare PtrSafe Function mdlRefFile_getInfo Lib "stdmdlbltin.dll" (ByVal modelRef As LongLong) As LongLong //Declare MDL Function

//Do other stuff

RefInfoP = mdlRefFile_getInfo(modelRef:=oRef.MdlModelRefP) //Get a Pointer to the Reference File

strRefName = "((struct referenceFile *)" & RefInfoP & ")" //Construct the beginning of the CExpression

iCacheValue = GetCExpressionValue(CExpression:=strRefName & "->display.flags.hiddenLineCaching") //Grab the value from the nested members of the struct

This is from the refernce.h header file included with the v8i SDK:

struct  referenceFile
    {
    File_id_desc            file_id;                    /* file identification */
    Ref_display             display;                    /* display information */
    Ref_attach_desc         attach;                     /* attachment description */
    Clip_desc               clip;                       /* clipping descriptor(points separate) */
    UInt32                  *colorMap_deprecated[2];    /* DEPRECATED: element to screen color mappings */
    RefLevelMasks           levelMask;                  /* Level mask */
    MSElementDescrP         readOnlyRefAttachEdP;       /* Attachment descriptor for reference attached during readonly session */
    MiscellaneousRefData    *extraDataP;                /* variable sized part of reference structure. More can be added to it. */
    void                    *additionalDataP[2];        /* Future use */
    };

The struct Ref_display named "display" contains the variable I want, "hiddenLineCaching".

The v8i code generates an error "expected struct/union name" when running in CONNECT, so I went hunting through the documentation.

I think I know (from what I can gather) that the MicrostationAPI has superseded MDL, so looking at the documentation and headers in the CONNECT SDK I found the struct Bentley::DgnPlatform::DgnAttachment.

In the header DgnAttachment.h is a similar struct to what was nested within the original referenceFile struct:

struct  RefDisplayFlags
    {
    UInt32      symbologySet:1;                 //!< The symbology has been set.
    UInt32      hiliteBoundary:1;               //!< Hilite the clip boundary when the DgnAttachment is selected in the reference dialog box (not persistent).
    UInt32      displayHilitedManip:1;          //!< Hilite all elements in the DgnAttachment when the DgnAttachment is the subject of a DgnAttachmnet manipulation command.
    UInt32      displayHilitedSelected:1;       //!< Hilite all elements in the DgnAttachment when the DgnAttachment is selected in the reference dialog box (not persitent).
    UInt32      dontUpdateChildren:1;           //!< Don't display child references (not persistent).
    UInt32      redundant:1;                    //!< This display of this DgnAttachment is the the same as another in the tree of DgnAttachments, so it is not displayed (not persistent).
    UInt32      missingModel:1;                 //!< The file for this DgnAttachment is found, but the model is not (not persistent).
    UInt32      rightNotGranted:1;              //!< The file is found, but we don't have View permissions (not persistent).
    UInt32      namedGroupFound:1;              //!< There is a named group limiting display to only members of that named group (not persistent).
    UInt32      revisionNotAvailable:1;         //!< There is a History revision specified, but that revision was not found in the file (not persistent).
    UInt32      resolvedHistoryTag:1;           //!< A revision is specfied as a tag and found.
    UInt32      revisionFromParent:1;           //!< The revision came from a parent history tag.
    UInt32      findModelByID:1;                //!< Use file_id.modelId to find the target model.
    UInt32      missingGeoCoordApp:1;           //!< This is a Geo referenced attachment, but the GeoCoord capabilities are not available.
    UInt32      missingGeoCoordSys:1;           //!< This is a Geo referenced attachment, but there is no GCS in either the parent model or the DgnAttachment model.
    UInt32      isCircular:1;                   //!< This is a circular reference? (Usually, such a DgnAttachment is not loaded at all).
    UInt32      calculatedTransformUsed:1;      //!< The DgnAttachment is set to be GeoCoord reprojected, but DgnPlatform was were able to substitue an identical linear transform.
    UInt32      namedGroupProcessingComplete:1; //!< We have done the named group processing for this reference already.
    UInt32      hiddenLineCaching:2;            //!< How hidden lines are saved in the file (stored in linkage).
    UInt32      proxyCacheSynchOption:2;
    UInt32      dontAddRefClip:1;
    UInt32      unused:9;
    };

I can see this contains the variable I want to access: hiddenLineCaching.

I have amended the CExpression thus:

 strRefName = "((struct Bentley::DgnPlatform::DgnAttachment *)" & RefInfoP & ")"
 iCacheValue = GetCExpressionValue(CExpression:=strRefName & "->RefDisplayFlags.hiddenLineCaching")

When this runs I receive an error "expected struct/union name".

Reading through the documentation it seems that not all structs are published / accessible, and I'm a long way from a C++ expert, so I'm stumped.

I can't figure out what struct I need to access and get the members of.

Any insight would be greatly appreciated.


Related problem is changing the slot number as well:

strRfName = "((struct referenceFile *)" & RefInfoP & ")"

lngSlotNumber = GetCExpressionValue(CExpression:=strRfName & "->file_id.referenceNum")

I haven't looked into this yet, but the struct is the same, so also doesn't work.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



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