Results 1 to 6 of 6

Thread: Cad Automation

  1. #1
    Join Date
    Jun 2004
    Location
    Brazil
    Posts
    3

    Cad Automation

    Hi

    I am using Autocad through VBScript (OLE Automation) and I'd like to know if
    there is another way to access the array when calling Utility.GetPoint() function. I know it returns an array, but I am not able to access these values through VBScript.

    Thanks
    Alessandro

  2. The Following User Says Thank You to pklj_2000 For This Useful Post:


  3. #2
    Join Date
    Jun 2004
    Location
    Detroit, MI
    Posts
    81
    Alessandro,

    I know VBScript support only one datatype, a variant, but I'm not sure I understand why you are not able to access the points. Your code should look something like this:

    Sub Test
    Dim varPnt as Variant
    ...
    varPnt = <document object>.Utility.Getpoint
    ...
    Debug.Print "Point was: " & varPnt(0) & ", " & varPnt(1) & ", " & varPnt(2)
    End Sub

    What type of error are you getting, or you're not getting anything?

    Sorry for the last post - I fat fingered the new keyboard! ops:

    Todd

  4. The Following 3 Users Say Thank You to TCARPENTER For This Useful Post:


  5. #3
    Join Date
    Jun 2004
    Location
    Brazil
    Posts
    3

    Q

    Hi, I get a mismatch error, with your code, but when I use UBound, it brings me 2

    Sorry for the delay, I posted this question everywhere (and it takes time) but nobody could answer me :cry:

    I just copy my code to VBA and it works!!




    <SCRIPT LANGUAGE="VBScript">
    Dim AcadObj
    Dim AcadDoc
    Dim AcadUtility

    set AcadObj = createobject("AutoCAD.Application")
    Set AcadDoc = AcadObj.ActiveDocument
    Set AcadUtility = AcadDoc.Utility
    Dim Point1
    Dim Point2
    dim a
    AcadUtility.CreateTypedArray Point1, vbDouble, 19.8161,19.7178,0
    AcadUtility.CreateTypedArray Point2, vbDouble, 19.8161,18.7178,0

    'it works
    AcadObj.Application.ZoomWindow point1, point2


    'error
    a= point1(1)

    </script>



    Regards
    Alessandro

  6. #4
    Join Date
    Jun 2004
    Location
    Detroit, MI
    Posts
    81
    Alessandro,

    Not quite sure if this is the problem or not, however, in your CreateTypedArray statement, you have forced the Point1 array to a double, and 'a' is defined as a variant, (although there should be no problem with this) VBScript may not tolerate this without a 'Set' keyword in front of a = point1(1)?

    What are you executing the vbscript through? Is this HTML (web page) or something else?

    Maybe a little more information would help.

    Todd

  7. #5
    Join Date
    Jun 2004
    Location
    Brazil
    Posts
    3
    Hi, Todd
    part of the designers works remotely. They draw, i.e. a structure, but the list of material used should be drawn from the headquarter (where the database is). So we'd like to make a web interface to draw this. If this solution dont work, we will probably create a 3-tier software in VB6

    I made some more tests and it behave strange. I tryed your idea w/o success. I get the same type mismatch error

    I even tryed that:
    the code "document.write(typename(point1))" returns me DOUBLE
    the code "IsArray(point1)" brings me TRUE
    then code "document.write(typename(point1(1)))" brings me an error

    Strange.. as "typename(point1) " is Double, I tryed operations with a Double, but it do not work...

    Regards
    Alessandro

  8. #6
    Join Date
    May 2011
    Posts
    1
    Very interesting concept. We can call the values using vb script too. Let me try before giving response.

    Thanks,
    Automation

  9. The Following 3 Users Say Thank You to chandrika For This Useful Post:


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •