MCAD - Workplane Creation

Discussion in 'AutoCAD' started by Jacob, Jul 31, 2003.

  1. Jacob

    Jacob Guest

    Hey all,

    [MDT6 - VBA]

    I'm trying to programatically create a workplane on edge/axis & planar
    parrallel. I can't find a means of referencing one of the world planes (Xy,
    Yz, Zx) for the parrallel plane. The closest I have been able to get is
    using an Absolute locator, but that won't work. Here's my code so far,
    includes creation of work axis, I didn't include all the variable
    declarations...

    Private Sub CreateWorkAxis()
    ' Get the part
    Set oPart = MCAD.ActiveDocument.ActivePart

    ' User selection of surface
    Set oPick = oUtil.Pick("Pick the concentric surface: ", mcSurface)
    Set oSurf = oUtil.GetObjectFromPick(oPick)

    ' Create concentric locator
    Set oLoc = oUtil.CreateLocator(mcConcentricLocator)
    oLoc.Object = oSurf

    Set oLocs = oUtil.CreateCollection(mcLocators)
    oLocs.Add oLoc

    ' Create work axis descriptor
    Set oWXD = oUtil.CreateFeatureDescriptor(mcWorkAxis)
    oWXD.Locators = oLocs

    ' Create the axis
    Set oFeat = oPart.AddFeature(oWXD)
    End Sub


    Private Sub CreateWorkPlane()
    ' Get the part
    Set oPart = MCAD.ActiveDocument.ActivePart

    ' Create the collinear locator
    Set oLocCL = oUtil.CreateLocator(mcCollinearLocator)
    oLocCL.Object = oFeat

    ' Create the absolute locator
    'Set oLocAB = oUtil.CreateLocator(mcAbsoluteLocator)
    'oLocAB.AbsoluteType = mcWorldZX

    ' Trying to get a refernce to the parallel plane using a parallel locator
    Set oLocPL = oUtil.CreateLocator(mcParallelLocator)
    'oLocPL.Object = ???

    ' Apply the locators
    Set oLocs = oUtil.CreateCollection(mcLocators)
    oLocs.Add oLocCL
    'oLocs.Add oLocAB

    ' Create the workplane descriptor
    Set oWPD = oUtil.CreateFeatureDescriptor(mcWorkPlane)
    oWPD.Locators = oLocs

    ' Create the plane
    Set oFeat = oPart.AddFeature(oWPD)

    End Sub

    Thanks for your help,
    Jacob.
     
    Jacob, Jul 31, 2003
    #1
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.