Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: How to automaticly select entities and create a block

  1. #11
    I could stop if I wanted to tyshofner's Avatar
    Join Date
    2004-03
    Location
    Dallas, Tx
    Posts
    229
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    Check to make sure you still have the "X" after the ssget call, or make sure the last answer to the "block" command is still a double quote (""). Or, if you can, just post your "master" code and we'll go from there.

    Code:
    (defun c:scalebar ()
    (setq sel1 (ssget "X" '((8 . "G-TTLB-PLBK"))))
    (cond
    ((= (tblsearch "BLOCK" "SCALEBAR") nil)
    (command "-block" "SCALEBAR" "0,0" sel1 "")
    (command "-insert" "SCALEBAR" "0,0" "" "" "0")
    )
    ((and (/= (tblsearch "BLOCK" "SCALEBAR") nil) (= (ssget "X" '((0 . "INSERT") (2 . "SCALEBAR"))) nil))
    (command "-insert" "SCALEBAR" "0,0" "" "" "0")
    )
    )
    )
    Ty

  2. #12
    100 Club dfuehrer's Avatar
    Join Date
    2004-11
    Posts
    130
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    Hello everyone,

    As requested, here is the code (with comments added) of my "masterpiece. It uses a DCL file to execute the function the user selects -- thanks to those in this forum who helped me get the DCL working properly!

    I'm just trying to ad the functionality to the A1 part of the code that will take the scale bar on our architectural drawings (layer Dependant) and select all entities, turn them into a block named SCALEBAR, inserted at 0,0 in model space of the drawing.

    The part of the code that I am trying to integrate runs perfectly as a stand-alone lisp. My comments about it are in the code.

    Anyway, thank you, one and all for the wonderful help you have been!

    Don
    Attached Files Attached Files

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

    Default Re: How to automaticly select entities and create a block

    Don,

    I haven't had a chance to look at your routine, but I had a question due to my curiousity. Would it be easier to just make the various scale bars that you need and just insert the desired block into your drawing?
    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

  4. #14
    100 Club dfuehrer's Avatar
    Join Date
    2004-11
    Posts
    130
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    No, not really. The scale bars are aligned with part of our 8 1.2 x 11 title blocks, and on those layout tabs, we are not putting them to any particular scale.

    Here at Mayo, we just show as much of the building as we can. The smaller buildings are zoomed in further, the larger ones zoomed out further. Sorry, this is not my solution, rather a legacy situation. I am no position to do things differently. Just bend like the willow (Grasshopper).

    The problem with the scale bars is that part of the bar has the line weight overridden to be wider. I want to grab everything in model space and set it to be all Bylayer (line weight, line type, and color). Still working on the color issue. Any ideas there??

    Don

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

    Default Re: How to automaticly select entities and create a block

    When you create your scale blocks, you can change the properties of those entities within your code or when you create the blocks manually.
    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

  6. #16
    100 Club dfuehrer's Avatar
    Join Date
    2004-11
    Posts
    130
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    The scale bars are already present, like I said legacy stuff. I am including an example. As you can see, they are on one layer, made up of text, lines, and lines that have their width modified...

    Don
    Attached Files Attached Files

  7. #17
    I could stop if I wanted to tyshofner's Avatar
    Join Date
    2004-03
    Location
    Dallas, Tx
    Posts
    229
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    Took a quick look. Try this out I didn't test it but it looked like you were trying to define the function within another function. I took out the "scalebar" defun and moved the function to the end of the file. You then call the function "(c:scalebar)" at the appropriate point in the code (where you had the defun).

    Let me know if it works.

    Ty
    Attached Files Attached Files
    Last edited by tyshofner; 2005-10-27 at 06:49 PM.

  8. #18
    100 Club dfuehrer's Avatar
    Join Date
    2004-11
    Posts
    130
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    Ty,

    I took more than a quick look. You rock! Thank you very much. It (now) makes sense to me that it the command SPACEBAR has to be defined under it's own heading, then called up using (c:spacebar) to run it where I want it in the code. THANK YOU!

    Are you going to attend AU this year?

    Don

  9. #19
    I could stop if I wanted to tyshofner's Avatar
    Join Date
    2004-03
    Location
    Dallas, Tx
    Posts
    229
    Login to Give a bone
    0

    Default Re: How to automaticly select entities and create a block

    My pleasure!! No I will not be attending AU this year . I'm just to busy.

    Ty

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 2
    Last Post: 2012-07-04, 07:40 AM
  2. Select entities by color of an exploded block
    By cadconcepts in forum AutoLISP
    Replies: 12
    Last Post: 2011-06-27, 03:02 PM
  3. Select entities off the screen
    By bweir in forum AutoLISP
    Replies: 5
    Last Post: 2007-04-20, 09:14 PM
  4. Can't select entities
    By jpaulsen in forum AutoCAD General
    Replies: 6
    Last Post: 2007-04-19, 03:20 PM
  5. Select entities without touching them
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2005-10-05, 12:22 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
  •