VBA Attach Reference File - Choose Orientation?

To all the VBA / MDL gods out there ...

Is there a chance to attach a reference file and define the orientation (p.ex. "front", "back", "left") as shown below?

I was not able to find a way to touch this setting so far ...

Parents
  • Unknown said:
    Is there a chance to attach a reference file and define the orientation

    References and Attachments

    Reference models are termed Attachment in VBA.  Attach a model as a reference like this...

    Dim oReference As Attachment
    Set oReference = ActiveModelReference.Attachments.Add (FileSpecification, ModelName, LogicalName, Description, MasterOrigin, ReferenceOrigin [, TrueScale [, DisplayImmediately]])

    You can see that there's no parameter to specify orientation, so you must use the methods of the new attachment.  Use Attachment.Rotate to specify a rotation, then Attachment.Rewrite to make it permanent.

    Orientation and Rotation

    What is presented to the user as orientation is, in VBA terms, a view rotation where the view is one of the standard viewsAttachment.Rotate rotates an attachment relative to a view rotation.  From VBA help...

    Attachment.Rotate rotates the Attachment about the View's axes, not the model's axes. Use ViewSpecifier to select the view.

    If the Attachment is clipped by an element, the clip element is rotated and immediately written to the file. In that case, the Attachment should always be written to the file to keep it in synch with its clipping element

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: quasi_modo 

  • Hi Jon - I expected your answer ;-)

    That's okay - it would have been nice to have the "standard" orientation directions like "front" or "back" available, but it's no problem to use the rotation instead.

    Thanks for your help!!

Reply Children
  • Unknown said:

    That's okay - it would have been nice to have the "standard" orientation directions like "front" or "back" available

    Look at the View object in VBA help.  There's a comment about View Rotation:

    Rotation specifies the View's rotation. A program can set a View's rotation by using the Rotation property, or by using one of a set of methods that set the View's rotation to a standard value. For example, the statements vw.Rotation = Matrix3dIdentity and vw.SetToTop are equivalent. Also, the statements vw.Rotation = Matrix3dFromAxisAndRotationAngle(0, Pi) and vw.SetToBottom are equivalent

     
    Regards, Jon Summers
    LA Solutions