Acad 2005 VBA still not complete!

Discussion in 'AutoCAD' started by cadmaxza, Jun 23, 2004.

  1. cadmaxza

    cadmaxza Guest

    Hi Group,

    I am hoping that Frank Oquendo reads this I desperately need his help or someone with similar advanced skills. We are upgrading to Acad2005. I have already started to write VBA code (always hoping it wont be necessary with every upgrade) - anyway - I quickly came to a point where I needed lisp again. The View object properties do not include the Twist angle. Frank wrote a great piece of code that runs lisp expressions in VBA. It was written prior to 2005 (EvalLispExpression) - if anybody knows how to alter the class to make it 2005 compatible - PLEASE reply.

    TIA.

    Kevin.
     
    cadmaxza, Jun 23, 2004
    #1
  2. cadmaxza

    Joe Sutphin Guest

    Perhaps this might help?

    Joe
    --

    Public Sub CreateViewWithTwistAngle()
    Dim oPViewport As AcadPViewport
    Dim oViewport As AcadViewport
    Dim oView As AcadView
    Dim Center(0 To 2) As Double
    Dim Width As Double
    Dim Height As Double

    'Define the PViewport
    Center(0) = 5.5: Center(1) = 4.25: Center(2) = 0
    Width = 5: Height = 5

    'Change space
    ThisDrawing.ActiveSpace = acPaperSpace

    'Create the PViewport
    Set oPViewport = ThisDrawing.PaperSpace.AddPViewport(Center, Width,
    Height)
    oPViewport.Display True
    oPViewport.ViewportOn = True
    ThisDrawing.MSpace = True
    ThisDrawing.ActivePViewport = oPViewport

    'Change the view direction
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    oPViewport.Direction = NewDirection

    'Set the twist angle
    oPViewport.TwistAngle = 0.57

    ThisDrawing.Application.ZoomExtents

    'Create a view
    ThisDrawing.Views.Add "Test1"

    ThisDrawing.ActiveSpace = acModelSpace

    'Reference model space viewport and set the view to the one created above
    Set oViewport = ThisDrawing.ActiveViewport
    Set oView = ThisDrawing.Views.Item("Test1")

    oViewport.SetView oView
    ThisDrawing.ActiveViewport = oViewport
    End Sub

    someone with similar advanced skills. We are upgrading to Acad2005. I have
    already started to write VBA code (always hoping it wont be necessary with
    every upgrade) - anyway - I quickly came to a point where I needed lisp
    again. The View object properties do not include the Twist angle. Frank
    wrote a great piece of code that runs lisp expressions in VBA. It was
    written prior to 2005 (EvalLispExpression) - if anybody knows how to alter
    the class to make it 2005 compatible - PLEASE reply.
     
    Joe Sutphin, Jun 23, 2004
    #2
  3. cadmaxza

    BRYSAUG Guest

    HI WE JUST CHANGED TO 2005 AND HAVE HARDLY NO PROBLEMS EXPLAIN WHAT U WANT IN DETAIL AND ILL HELP
     
    BRYSAUG, Jun 23, 2004
    #3
  4. <covering ears>
     
    Frank Oquendo, Jun 23, 2004
    #4
  5. Why are you SHOUTING ??

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    IN DETAIL AND ILL HELP
     
    Jorge Jimenez, Jun 23, 2004
    #5
  6. What's even funnier... this guy is in the 2005 ng asking what vba/cls files
    are. <snicker>

    --
    R. Robert Bell


    Why are you SHOUTING ??

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    IN DETAIL AND ILL HELP
     
    R. Robert Bell, Jun 23, 2004
    #6
  7. cadmaxza

    cadmaxza Guest

    Thanks guys. Ed gave me some great info too, check this:

    "I could give you the correction, but instead, I'll show you how to find it. Every class is identified by a name and a id. You can find out what classes have been registered on your pc using the registry editor. Go to Start>Run and type "regedit". Everyone says how dangerous it is to edit the registry, but your just going to look at it. On the left is a typical tree browser. Expand the HKEY_CLASSES hive and search for "VL", the visual lisp interface. The GetInterfaceObject expects this name as an argument. You probably have more than one listed, choose the other one. If you look under the class name, you will find the id, CLSID or class id, which is a GUID, globally unique identifier. Some win api methods use this to id a class."

    This produced the answer I was looking for..
    Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")

    I do actually have a acad2005 problem, the sheet set manager procedures appears to support only Attach type xref attachment - but I'm sure its just my lack of understanding

    Have a great day.

    Kev.
     
    cadmaxza, Jun 24, 2004
    #7
  8. cadmaxza

    cadmaxza Guest

    Thanks Joe, 2 problems.

    1.
    'next line produces error if there are no viewports
    'ThisDrawing.MSpace = True
    'just included an error catcher...

    Err.Clear
    On Error Resume Next
    ThisDrawing.MSpace = True
    If Err <> 0 Then
    ThisDrawing.ActivePViewport = oPViewport
    End If

    2.
    Views.Add - the new views traget is 0,0 it does not "read" the current view !!! Maybe there's a system variable set incorrectly on my side?
    'Create a view
    ThisDrawing.Views.Add ViewName

    Cheers,

    Kevin.
     
    cadmaxza, Jun 24, 2004
    #8
  9. cadmaxza

    cadmaxza Guest

    Ooooops!!! The thisdrawing.mspace = true error jobby is my mistake - I wasnt checking the paper space viewports, they were too small to enable model space :cool: silly billy !!!

    But the I'm still stuck with the view.add problem - I'm using sendcommand for now...

    Cheers,

    Kevin.
     
    cadmaxza, Jun 24, 2004
    #9
  10. Please try to be more descriptive about your problem. That brief one-liner
    for #2 doesn't make much sense on my end.

    --
    R. Robert Bell


    Ooooops!!! The thisdrawing.mspace = true error jobby is my mistake - I wasnt
    checking the paper space viewports, they were too small to enable model
    space :cool: silly billy !!!

    But the I'm still stuck with the view.add problem - I'm using sendcommand
    for now...

    Cheers,

    Kevin.
     
    R. Robert Bell, Jun 24, 2004
    #10
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.