Results 1 to 6 of 6

Thread: Use degree instead radiant in inserting a block

  1. #1
    Member
    Join Date
    2009-07
    Posts
    16
    Login to Give a bone
    0

    Default Use degree instead radian in inserting a block

    I use the following sentence for inserting a block.

    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertPnt, "ResBlock1", 1#, 1#, 1#, 3.1415)

    How can I use degree exp. 45, 90, 180, instead of 3.1415/4, 3.1415/2, 3.1415, ..... for the insertion?
    Last edited by linying-d; 2010-02-16 at 07:00 PM. Reason: wrong spell

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,388
    Login to Give a bone
    0

    Default Re: Use degree instead radiant in inserting a block

    You have to do the conversion first.
    Code:
    Public Function DegToRad(Angle As Double)
        'convert degrees to radians
        DegToRad = ((Angle / 180) * PI)
    End Function
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2009-07
    Posts
    16
    Login to Give a bone
    0

    Default Re: Use degree instead radiant in inserting a block

    When I run the program. "Variable not defined" for "Pi" shows up. Is that because the AutoCAD version I use is old, so the compiler can't recognize "Pi"? I use version 2002. I predefine pi as double, and set to 3.14159265358979. Is that the only way ? I noticed if I use pi=3.1415, a noticeable angular error come out.But I use 3.14159265358979, the result is good to me. I just want to know is that the only way to do it?

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,388
    Login to Give a bone
    0

    Default Re: Use degree instead radiant in inserting a block

    Yes, that will do it. VB doesn't have a constant defined for PI. I have it defined somewhere else in my code, but neglected to include it. Autocad can deal with a constant to 16 significant digits.
    C:> ED WORKING....

  5. #5
    Member
    Join Date
    2009-07
    Posts
    16
    Login to Give a bone
    0

    Default Re: Use degree instead radiant in inserting a block

    It feels like input a 90 degree get a exact right angle, input (Pi/2) can only get a angle close to 90 but not exactly. Actually, if Pi has enough digits, the result is within expectation, it would be Ok to accept. Am I right?

    Thank you.

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,388
    Login to Give a bone
    0

    Default Re: Use degree instead radiant in inserting a block

    Depending on your units settings, acad will report it as 90.
    C:> ED WORKING....

Similar Threads

  1. message when inserting block
    By mdsalman2003 in forum AutoCAD General
    Replies: 3
    Last Post: 2010-01-26, 06:30 AM
  2. Error inserting block
    By ekolto in forum AMEP General
    Replies: 2
    Last Post: 2008-07-23, 03:58 PM
  3. Inserting Block command
    By angelaaleigh in forum AutoLISP
    Replies: 2
    Last Post: 2008-05-09, 03:09 PM
  4. Keeps Inserting last Block, not the Block selected
    By Buffeldrek in forum AutoCAD General
    Replies: 11
    Last Post: 2007-01-03, 07:57 AM
  5. Replies: 9
    Last Post: 2006-08-24, 09:29 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
  •