Results 1 to 8 of 8

Thread: Why does this return nil...

  1. #1
    Member
    Join Date
    2013-10
    Posts
    16
    Login to Give a bone
    0

    Default Why does this return nil...

    Ok, I am a beginner Autolisper. I am trying to understand the issue with selection sets of dynamic blocks and effective names etc. I am basically trying to work through some code kindly suggested by BlackBox line by line. It's a fairly slow process as I am a beginner but I am getting there. Anyway, what I am wanting to know is why does this line of code return "nil" when I know there are blocks with the effective name *U32 in the drawing?

    (setq ss1 (ssget "_x" '((0 . "INSERT")(2 . "'*U32"))))

    I want the Autolisp program to ultimately select dynamic blocks by their non-effective name and by z coord then place said blocks on a specific layer. So there will be more code than just this obviously, but if I cant get this line to work in isolation then there is no hope for me!!!

    Any help appreciated. I am sure this is another quite simple error I am making.

    CM

  2. #2
    All AUGI, all the time pbejse's Avatar
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    Quote Originally Posted by chris.mackay434411 View Post
    (setq ss1 (ssget "_x" '((0 . "INSERT")(2 . "'*U32"))))

    CM

    You are using the wrong symbol

    Code:
    (setq ss1 (ssget "_x" '((0 . "INSERT")(2 . "`*U32"))))
    ` (reverse quote) Escapes special characters (reads next character literally).

    For some it's Grave Accent / BackTick

  3. #3
    Member
    Join Date
    2013-10
    Posts
    16
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    Ha! I told you it was something simple!!! many thanks.

  4. #4
    All AUGI, all the time pbejse's Avatar
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    Quote Originally Posted by chris.mackay434411 View Post
    Ha! I told you it was something simple!!! many thanks.
    A word of advice Chris, Anonymous names are very unpredictable , The number you specified after the "*U" would probably be something else entirely on another drawing session:

    Best way to utilize that filter to write it to something like this

    Code:
    (setq ss (ssget "_X" ('(0 . "INSERT")'(2 . "RealName,`*U*"))))
    Where RealName is the actual name of the Dynamic Block [AFAICT: it only applies to DB nowadays. not sure though] <Unless the blocks are converted to Anonymous block via vla-ConvertToAnonymousBlock function>

    Then iterate thru the selection using vla-get-effectivename to capture the correct block

    HTH

    EDIT: Or from some converted drawing to and fro using other CAD products [Civil 3D/Revit...]
    Last edited by pbejse; 2013-11-26 at 11:58 AM.

  5. #5
    Member
    Join Date
    2013-10
    Posts
    16
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    so why might this select only the *U* blocks and not the non dynamic blocks named "Dowel"?

    (ssget "_x" '((0 . "INSERT")(2 . "`*U*, Dowel"))))

  6. #6
    Member
    Join Date
    2013-10
    Posts
    16
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    Thanks.

    Yes, that is generally where I am going with it. I have just been breaking down a full lisp routine that does that, but line by line so I have a full understanding rather than just using someone else's code. So, does your line of code there select all blocks called Realname AND all blocks with an effective name beginning with *U ? Because that isn't the selection set I ultimately want.

    I want to basically hard code a non-effective block name (and a z coord ie (-4 . "*,*,=") (10 0.0 0.0 100.0)) and create a selection set of those blocks only.

  7. #7
    All AUGI, all the time pbejse's Avatar
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    Quote Originally Posted by chris.mackay434411 View Post
    so why might this select only the *U* blocks and not the non dynamic blocks named "Dowel"?

    (ssget "_x" '((0 . "INSERT")(2 . "`*U*, Dowel"))))
    You have an extra space after the "," and before the block name ", Dowel" <---- that is why

  8. #8
    Member
    Join Date
    2013-10
    Posts
    16
    Login to Give a bone
    0

    Default Re: Why does this return nil...

    yep. i'd actually figured that out not long after i'd posted that! please believe me!!!!

Similar Threads

  1. Replies: 10
    Last Post: 2016-06-27, 12:04 AM
  2. RETURN TO LDD
    By Wish List System in forum Civil 3D Wish List
    Replies: 13
    Last Post: 2015-10-08, 03:40 PM
  3. Return Air Diffuser?
    By MNsnowtaTy in forum Revit MEP - General
    Replies: 4
    Last Post: 2009-03-27, 03:11 PM
  4. Return Values
    By BeKirra in forum AutoLISP
    Replies: 12
    Last Post: 2009-03-23, 04:37 AM
  5. How do you create a Boxed Return or Cornice Return?
    By rgecy in forum Revit Architecture - General
    Replies: 7
    Last Post: 2004-05-20, 04:42 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
  •