vbscript

Discussion in 'AutoCAD' started by amartim, Jul 1, 2004.

  1. amartim

    amartim Guest

    Hi,
    I am using AutoCad2002 and I'd like automating it through VBScript. When I call Utility.GetPoint function, it returns me an array, but I am not able to get the values. I get a mismatch type error.

    But this work out on VBA or VB6.
    Can anyone help me?
     
    amartim, Jul 1, 2004
    #1
  2. amartim

    TomD Guest

    I'd suggest posting the relevant portions of the code. I'm not a VBA
    wizard, but "I am not able to get the values......mismatch type error"
    doesn't say much.

    call Utility.GetPoint function, it returns me an array, but I am not able to
    get the values. I get a mismatch type error.
     
    TomD, Jul 1, 2004
    #2
  3. amartim

    Gordon Price Guest

    call Utility.GetPoint function, it returns me an array, but I am not able to
    get the values. I get a mismatch type error.
    VBScript uses untyped variables, everything is a variant. VBA and VB6 use
    typed variables. So, try explicityly converting your variables using CInt,
    CDbl, CLng, etc. Not sure off the top of my head if a point is an array of
    Longs or Doubles or what.

    Best,
    Gordon
     
    Gordon Price, Jul 1, 2004
    #3
  4. amartim

    amartim Guest

    Hi,
    when I used Join function (converts an array to a commas separated string) I got this error:
    "variable uses an automation type not supported in vbscript" I went to Microsoft site and they said: "Only use variable types recognized by VBScript."

    I guess there is no compatibility... If so, do you know another way to get the point selected by the user else then this array

    Thanks

    Follow my code

    <script language="VBScript">
    dim obj
    set obj = createobject("Autocad.Application")

    Set acadDoc = obj.ActiveDocument
    acadDoc.Application.WindowState = 3

    dim PtFim
    PtFim = acadDoc.Utility.GetPoint(, "Entre com o ponto final: ")

    'this line works out
    acadDoc.ModelSpace.AddText "%%UNOTA(s):", PtFim, 2


    if isarray(ptfim) then
    DOCUMENT.WRITE(UBOUND(PTFIM,1)) <-- returns 2
    ar= join(PTFIM) <-- error above described
    end if

    </script>
     
    amartim, Jul 1, 2004
    #4
  5. amartim

    Gordon Price Guest

    Microsoft site and they said: "Only use variable types recognized by
    VBScript."
    the point selected by the user else then this array

    Not sure there. However, I am wondering why you would use VBScript external
    to Acad when Acad is interacting with a user? I usually only use
    WSH/VBScript to automate AutoCAD doing things on its own, not user driven.
    Is there a reason you couldn't write your app in VBA?

    Best,
    Gordon
     
    Gordon Price, Jul 2, 2004
    #5
  6. amartim

    amartim Guest

    Hi,
    We need to automate part of the process. The drawing is made externally from another company, but the list of materials should by inserted on the drawing remotly, through the internet. I belive all the job needed to create this list externally is possible, but I need the drawer to select where the list will be created on the drawing. So I need the GetPoint function. If you have another strategy...

    regards
    Alessandro
     
    amartim, Jul 5, 2004
    #6
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.
Similar Threads
Loading...