Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: scale a specific block by using the dimscale variable

  1. #1
    I could stop if I wanted to
    Join Date
    2004-07
    Location
    Baton Rouge, Louisiana
    Posts
    254
    Login to Give a bone
    0

    Default scale a specific block by using the dimscale variable

    i am trying to code in a lisp routine to scale a specific block by using the dimscale variable. i know how to do using a button since most people here use the keyboard i was going to use the a command to auto insert the block (BK) which will scale up to the dimscale (ex. 96.00). below is the code so far, i keep getting to few arguments as error.



    (DEFUN C:BK (P FF)
    (setq p (getpoint "Select insertion point... "))
    (setq ff (GETVAR "DIMSCALE"))
    (command "insert" "BK" P FF "" "")
    )

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    Check this out ....

    Code:
    (defun c:Test (/ p blk sc)
      (cond ((not (tblsearch "BLOCK" "BK")))
            ((not (setq p (getpoint "\n Select insertion point... :"))))
            (t
             (command "_.-insert"
                      "BK"
                      "_non"
                      p
                      (setq sc (rtos (getvar 'dimscale) 2))
                      sc
             )
            )
      )
      (princ)
    )

  3. #3
    I could stop if I wanted to
    Join Date
    2004-07
    Location
    Baton Rouge, Louisiana
    Posts
    254
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    thanks it works

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    Quote Originally Posted by vtmiii View Post
    thanks it works
    You're welcome

  5. #5
    I could stop if I wanted to
    Join Date
    2004-07
    Location
    Baton Rouge, Louisiana
    Posts
    254
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    it works once the block is inserted into the drawing. need it to work if the block is not there. if i could just get the others to use the toolbars. i could make it work with out the lisp routine

  6. #6
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    Quote Originally Posted by vtmiii View Post
    need it to work if the block is not there.
    How you want to insert the block if it is not existed into your current drawing ?

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

    Default Re: scale a specific block by using the dimscale variable

    The folder the blocks are located in need to be added to your support file search path, or you need to supply the path to the routine if it cannot be added.
    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. #8
    I could stop if I wanted to
    Join Date
    2004-07
    Location
    Baton Rouge, Louisiana
    Posts
    254
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    the path is there for the block, i have other blocks that then name of block is also a command. this is the first one that the dimscale is used to scale the block up, as i said in other post. i can make the command work with the toolbars. just not that good at lisp programming. i will post those rutines latter for others to view. but this command needs to look for the block in the path and insert it into the drawing, if i coulld get others to use the icons on the toolbars or pallates, i could solve the problem in 5 min

  9. #9
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: scale a specific block by using the dimscale variable

    You can insert the needed block by added the whole file path to the drawing that contains the block and with the following line of code you can insert it .

    you should replace the file path according to your file path .
    Code:
    (command "_.-insert"
             "C:\\Users\\Tharwat\\Desktop\\Drawing1.dwg"
             "_non"
             p
             (setq sc (rtos (getvar 'dimscale) 2))
             sc
    )

  10. #10
    I could stop if I wanted to
    Join Date
    2004-07
    Location
    Baton Rouge, Louisiana
    Posts
    254
    Login to Give a bone
    0

    Smile Re: scale a specific block by using the dimscale variable

    ok thanks to all the help, we actually have our directory for blocks set up in the option menu. we did this since all the blocks are on the server and helps keeps the drawings consistant. i finally managed to get what i wanted the lisp routine work after looking at the sugestions. below is the routine that i got working for us to use.:

    Code:
    (defun c:BK (/ p blk sc)
      (setq p (getpoint "\n Select insertion point... :"))
        (setq sc (getvar 'dimscale))    
             (command "insert" "BK" P SC "" "")
              (princ)
    )

    Thanks again for the help and suggestions. i guess i really need to take a real class on lisp programing. all i have done is trial by error.
    Last edited by Opie; 2012-04-19 at 09:24 PM. Reason: [code] tags added

Page 1 of 2 12 LastLast

Similar Threads

  1. Block library, block scale, dimscale,ltscale
    By dalewww in forum AutoCAD General
    Replies: 6
    Last Post: 2008-09-10, 03:45 PM
  2. Size Attribute depending on the DIMSCALE variable?
    By Dave F. in forum Dynamic Blocks - Technical
    Replies: 3
    Last Post: 2008-05-30, 09:06 PM
  3. Dimscale variable resets on paste
    By timothyjturner in forum AutoLISP
    Replies: 14
    Last Post: 2007-08-03, 02:19 PM
  4. DIMSCALE System Variable - How does it work
    By SRBalliet in forum AutoCAD General
    Replies: 1
    Last Post: 2006-01-31, 04:12 PM
  5. Create a Layer based on DimScale variable
    By dhurtubise in forum AutoCAD Customization
    Replies: 2
    Last Post: 2005-12-08, 07:09 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
  •