Results 1 to 3 of 3

Thread: Extra cdrs in dotted pairs

  1. #1
    Member
    Join Date
    2016-08
    Posts
    2
    Login to Give a bone
    0

    Default Extra cdrs in dotted pairs

    Hello all,

    Little new here.
    I've been working on a routine to explode blocks and return the linework of exploded blocks to their original layers. I've had to rewrite it a couple times to pinpoint the bug, and I'm testing the layer retrieval portion of the code.

    I actually have two questions:

    -When I have one or more blocks inserted in my drawing and run the following routine, I get "extra cdrs in dotted pair on input". From everything I've read in the API and searching on this and other forums, I believe I'm using the appropriate technique to extract the layer info, but obviously, I am misunderstanding something

    -When I don't have any blocks inserted in my drawing and run the routine, I get "bad argument type: lselsetp nil", this problem appears to be located in the evaluation statement of my while loop ('((entget (ssname ss i)))') Maybe I'm not using entget correctly? I checked the AutoDesk help pages for these commands and they look fine to me. I just want to check if I'm at the end of the selectionset or not


    Code:
    Code:
    (defun C:BlockHunter (/ i entl ent doc ss ss1 layer laylist)
      ;; Create a list of all non-block entities in the drawing
      ;; Create list of layers in drawing
      ;; Create a list of all blocks in drawing
      ;; Set all blocks to explodable
      ;; Explode all blocks
      
    
      (setq ss (ssget "_X" '((0 . "INSERT"))))
      
    
      (setq i 0)
      (while ((entget (ssname ss i) ))
        (progn
          
    	    (setq layer (cdr (assoc 8(entget (ssname ss i) ) ) ) )	;;(setq layer (cdr (assoc 8 (entget (ssname ss i) ) )))
    	     (princ layer)
    	    ;;(setq i (+ 1 i))
          )
        )
      )
    Last edited by BlackBox; 2019-06-27 at 06:34 PM. Reason: Please use [CODE] Tags

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,552
    Login to Give a bone
    0

    Default Re: Extra cdrs in dotted pairs

    Have you tried using the Express Tool Burst command which leaves the linework of exploded blocks on their original layers instead of Explode?
    https://knowledge.autodesk.com/suppo...AEED2-htm.html

    You do realize both Burst and Explode can increase drawing size considerably. Why do it?

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

    Default Re: Extra cdrs in dotted pairs

    Hi,
    Hopefully the following would help you out to comprehend what's going on in codes, if not, then feel free to ask.
    Code:
     (if ;; if the following expression is valid then proceed to next expression.
         (setq ss (ssget "_X" '((0 . "INSERT"))))
       (progn ;; progn function is to allow you to have more than one expression as into your example / codes.
         (setq i 0)
         (while (setq ent (ssname ss i)) ;; you had an extra bracket and what's more importantly, is that you need to
                                         ;; check if the entity is valid then entget the object to
                                         ;; pass over any error message such  "bad argument type: lselsetp nil".
        ;; (progn <- this progn is not required since while function would take care of all following expressions if the first is equal to True.
          (setq layer (cdr (assoc 8 (entget ent))))
           (princ layer)
           (setq i (+ 1 i))
          )
        )
       ) ;; end of IF function.

Similar Threads

  1. Replies: 0
    Last Post: 2017-12-21, 05:05 PM
  2. Removing the double list pairs
    By Ehsan in forum AutoLISP
    Replies: 1
    Last Post: 2012-07-16, 03:47 PM
  3. Door Schedule and Door that are in Pairs
    By caddman13 in forum ACA General
    Replies: 6
    Last Post: 2008-04-26, 03:07 PM
  4. Replies: 4
    Last Post: 2006-08-09, 03:30 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
  •