modifying the clip region of a reference

How can a clip region of a reference be reset from within a vba/mdl program. I can see a set clip option but no clear way of obtaining the exisiting one. Any ides sample code?

  • Reference Clip Boundary and Masks

    A MicroStation attachment may have one or more masks. Masks are used to hide part of an attachment in one or more views. Note that …

    1. A mask is a property of an attachment. The attachment data are part of the active model. The attached model is unaffected (it's read-only)
    2. An attachment may have zero or one clip boundaries, and zero to N clip masks
    3. Clip masks are stored in arrays of 2D points (DPoint2d). Because a mask lies always in the plane of its view, even in 3D, a third dimension is not required
    4. A model may be attached more than once. Each instance of that model's attachments may have its own set of clip masks

    A clip boundary, if set, will clip the presentation of elements in the attachment in a specified view. The elements themselves continue to exist in the read-only attachment. Although they are shown clipped, the original element is not changed.

    Alan Boyd said:
    How can a clip region of a reference be reset from within a VBA macro?

    Nothing is impossible to a hardcore VBA programmer, but getting at the required information would be tedious. Modifying it would definitely be hard work.

    In other words, prefer MDL for this job.

    Alan Boyd said:
    How can a clip region of a reference be reset from within an MDL program?

    Use mdlRefFile_getInfo to obtain a ReferenceFile* pointer. That pointer leads you through a maze of structs defined in header file refernce.h (my spelling is correct).

    Put on your spelunking gear. Inside struct clip_desc you will find …

    • int clip_vertices — the no. of vertices in the following array
    • DPoint2d* clipP — the list of clip points. The list is dynamically reallocated when a user creates or deletes a clip mask

    The clipP array stores all the clip masks. Each mask is separated from its predecessor by a special numeric value DISCONNECT. DISCONNECT is #defined in MDL header msdefs.h.

    To answer your question, you need to …

    1. Extract the existing array(s) of 2D points
    2. Deallocate memory pointed at by clipP
    3. Decide which member of the list you want to change
    4. Reconstruct the list …
      • Allocate the required amount of memory for your new list
      • Substitute your new sub-array at the appropriate point
      • Remember to include a DISCONNECT  between each mask
      • Assign the total no. points to clip_vertices
    5. Rewrite the attachment

    I hope the above clarifies why you would not want to use VBA  8-)

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions