See the top rated post in this thread. Click here

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: The Visual Basic Editor in ACAD2006

  1. #11
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    The MYLINE subfunction is the guts of this example. It has three arguments, the bearing, the distance, and a startpoint. This was completely made up by me.

    The FOO subfunction is just an example of how to use the MYLINE subfunction.

    pt1 = ThisDrawing.Utility.GetPoint(, "Pick Start Point")
    This line is just so you have a startpoint - your main function may get a startpoint from somewhere else (like maybe the end of an existing line or something)

    Call myLine(1.3, 3.5, pt1)
    This line is calling the MYLINE sub - the 1.3 is just an angle I made up and the 3.5 is just a distance I made up.

    You don't HAVE to use it like this - you can simply call the ADDLINE function, but I was just trying to show how you might calculate points first and THEN call the ADDLINE function since that is easier than creating a random line and then trying to change it's endpoints.
    R.K. McSwain | CAD Panacea |

  2. #12
    Member
    Join Date
    2006-04
    Posts
    24
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    I didn't realize that the replies were going on a second page!

    Ok thanks for explaining what the 1.3 and the 3.5 were. I started fumbling aroudn more and got your sub to work the way I wanted.

    However, I had to do this:

    dim realbearing as double, stringbearing as string
    stringbearing = text1.text
    realbearing = thisdrawing.utility.angletoreal (stringbearing, acdegreesminutesseconds)

    Then I sent the distance and the realbearing information to the line function

    It started to work and was going okay when I tested it, but then I started getting this weird error message and it wouldn't stop. I can't remember what it said, but I gave up for the day.

    I'll see if it does it again later

  3. #13
    Member
    Join Date
    2006-04
    Posts
    24
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Ok, I've been playing some more, and one thing that bothers me is that after I generate a line, it doesn't refresh my autocad window until I draw the NEXT line. is there a way to make the window refresh after I create each line?

    Here's how it goes now

    I click a button to create my line, and then my form comes back and I can draw another line with other dimensions. If I choose to , I see the LAST line I did but not the one I drew last. If I exit my program my final line shows up

    Can you help?

  4. #14
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Quote Originally Posted by justinxxvii
    it doesn't refresh my autocad window until I draw the NEXT line. is there a way to make the window refresh after I create each line?
    You can use the UPDATE method on the just created line. If you have a routine that generates a lot of geometry, don't do this, just wait until the end and regen the viewport.
    R.K. McSwain | CAD Panacea |

  5. #15
    Member
    Join Date
    2006-04
    Posts
    24
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Ok I figured that out, it's AutoCAD.update

    Thanks for your help on this!

    I'm going to come up with some other stuff to put into this project and maybe you can help me with it too!

  6. #16
    Member
    Join Date
    2006-04
    Posts
    24
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    by the way, this is a generic VB question, but how can I make a textbox tab to the next object after I type in 2 digits?

    I set the max length to 2, but I don't know what property to set to make it automatically tab once the numbers are plugged in

  7. #17
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Quote Originally Posted by justinxxvii
    by the way, this is a generic VB question, but how can I make a textbox tab to the next object after I type in 2 digits?

    I set the max length to 2, but I don't know what property to set to make it automatically tab once the numbers are plugged in
    Could you check the textbox character length on any changes? Once it has reached the maximum length, set the focus to the next textbox.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #18
    Member
    Join Date
    2006-04
    Posts
    24
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Ok, I will play with it tomorrow

    Is this code that I should put into a timer, or make a loop to keep monitoring the character length?

  9. #19
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Quote Originally Posted by justinxxvii
    Ok, I will play with it tomorrow

    Is this code that I should put into a timer, or make a loop to keep monitoring the character length?
    The control itself (the textbox) includes an event ("changed" I think) - put your code in that event
    R.K. McSwain | CAD Panacea |

  10. #20
    Member
    Join Date
    2006-04
    Posts
    24
    Login to Give a bone
    0

    Default Re: The Visual Basic Editor in ACAD2006

    Thanks for all of your help, guys.

    By the way, I'm getting ready to start searching google or something for this but are there any resources you guys would recommend I take a peek at? The most helpful thing to me would probably be a complete list of all the calls and their options so I can maybe print it out and just go over it during periodic free time.

    My aspiration is to code a small surveying application for AutoCAD. I'm a surveyor with two other gentlemen who aren't super computer hip so I wanted some more of the GUI options they're used to instead of typing options in a command line. We also have Carlson 2006 but it lacks a lot of features that Autocad has. The only thing really awesome about it is that it can download points from the handheld

    Anyway, thanks everybody

    My next question is going to be how to maybe read information (properties) of objects in autocad, like arcs and lines and then use that data later.

    First I'm gonna go hunting

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. visual lisp editor should be like visual studio
    By Wish List System in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2011-11-17, 05:33 PM
  2. Autocad LT vs Visual Basic 6
    By hibbe.wiersma172517 in forum ARX
    Replies: 2
    Last Post: 2008-08-21, 08:16 AM
  3. The future of Visual Basic
    By MikeJarosz in forum VBA/COM Interop
    Replies: 4
    Last Post: 2006-08-04, 06:29 PM
  4. Microsoft Visual Basic
    By jcronburg in forum VBA/COM Interop
    Replies: 1
    Last Post: 2004-06-16, 07:49 PM

Posting Permissions

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