Orthogonal section view in MDT

Discussion in 'AutoCAD' started by hgyurika, Jan 31, 2005.

  1. hgyurika

    hgyurika Guest

    Hello,

    I would like to create an orthogonal section view in MDT by VBA, but I have a problem with it.
    I create the base view, and after that I would create the ortho section view, but my code is wrong.

    In my opinion the problem is with the sectioncutobjects variable.
    Here is my code:

    Dim parts As McadObjects
    parts = Util.CreateCollection(McadCollectionType.mcObjects)
    parts.Add(Anya)
    Mcad.ActiveDocument.Mode = McadDesignMode.mcDrawingMode
    acadDoc.Application.ZoomExtents()
    Dim viewDesc As McadDrawingViewDescriptor
    viewDesc = Util.CreateDrawingViewDescriptor(McadViewType.mcBaseView)
    Dim id As McadDisplayType
    id = mcWireFrame
    'viewDesc.DisplayType = mcWireFrame
    viewDesc.DataSet = parts
    viewDesc.Label = "Base view"
    viewDesc.Location = Ge.Point(297 - 297 / 3, 210 / 2, 0)
    viewDesc.OrientationAxis = Anya.WorkAxes.Item(1) 'Anya is the active part
    viewDesc.OrientationAxisDirection = mcPositiveY
    viewDesc.OrientationPlane = Anya.WorkPlanes.Item(2)
    viewDesc.ViewScale = 1.0
    viewDesc.SectionType = mcSectionNone
    viewDesc.HiddenLinesCalculated = True
    viewDesc.HiddenLinesDisplayed = True
    Dim baseview As McadDrawingView
    baseview = Mcad.ActiveDocument.DrawingMgr.CreateView(viewDesc)
    baseview.Update(True)

    Dim viewdescriportho As McadDrawingViewDescriptor
    viewdescriportho = Util.CreateDrawingViewDescriptor(McadViewType.mcOrthogonalView)
    viewdescriportho.ParentView = baseview
    viewdescriportho.Location = Ge.Point(297 / 3, 210 / 2, 0)
    viewdescriportho.Label = "Ortho"
    viewdescriportho_OrientationType = mcLeftOrientation
    viewdescriportho.SectionType = mcSectionFull
    'viewdescriportho.SectionLabel = "A-A"
    'viewDesc.SectionHatchOn = True
    viewDesc.HiddenLinesCalculated = True
    'viewdescriportho.HiddenLinesDisplayed = True
    viewdescriportho.ShowTapLines = True

    Dim orthoview As McadDrawingView
    orthoview = Mcad.ActiveDocument.DrawingMgr.CreateView(viewdescriportho)
    ' acadDoc.Plot.DisplayPlotPreview(AcPreviewMode.acFullPreview)
    acadDoc.Regen(AcRegenType.acAllViewports)

    If there is no section, the code works, but in case sectionfull the error message is:

    Generic failure to execute operation with provided arguments.

    if the viewdescriportho.sectioncutobjects=Anya.Workplanes.Item(1)

    the parameter is wrong.

    Another problem with the code the hidden lines are not displayed...

    Thanks for your answers!
     
    hgyurika, Jan 31, 2005
    #1
  2. hgyurika

    hgyurika Guest

    up...
     
    hgyurika, Feb 7, 2005
    #2
  3. You should post this message on "autodesk.mechanicaldesktop", hopefully
    someone there can help you.

    Roger Mollon
    MSD - Novi
    Autodesk Inc.
     
    Roger Mollon \(Autodesk\), Feb 7, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.