See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: AutoLISP Help - Code not working on all machines

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2011-07
    Posts
    1
    Login to Give a bone
    0

    Default AutoLISP Help - Code not working on all machines

    Hello, I'm relatively new to the forum as well as LISP programming in general. I was hoping that I'd be able to get some help with de-bugging why the code I wrote will work on my machine and the rest of the team in my office (Seattle), but not with our satellite office in Dallas. The portion of code that I believe is not working is below:

    Code:
     (command "-xref" "b" "*base"); this works fine and names the file consistently between locations
     (Command "regenall")
     (command ".explode" (ssget "_X" '((0 . "insert") (2 . "'*base"))) ""); this is what seems to break
    A little background, we are a residential builder using AutoCAD 2014, and we have what we call a "Base" plan that is xref'd into the "elevation" file. The elevation file contains linework forward of a specific point on the house (this content is subject to change base on the elevation we decide to put on the house), and the Base plan contains everything from that specific point to the rear of the house (all the stuff that won't change). What I am trying to do is automate creating some background files for the engineering firm to utilize for different portions of the house. To do this I need to insert the xref and explode the block created by that insertion. The rest of the routine will then set the layers for the visibility I need and then wblock out the necessary files. I'm seriously confused why this will function without issue on my machine and that of my co-workers here in Seattle but will not function properly on our machines in Dallas. The entire code is attached for reference if necessary. Please let me know if there is something I'm missing. Thank you in advance for your time.
    Attached Files Attached Files
    Last edited by BlackBox; 2014-12-08 at 06:28 PM. Reason: Please use [CODE] Tags

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

    Default Re: AutoLISP Help - Code not working on all machines

    Is there a significance for the apostrophe within the block name of your selection set filter?
    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

  3. #3
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: AutoLISP Help - Code not working on all machines

    The explode command for several releases would only allow for single items to be exploded.

    I know 2010 is like that.

    The work around for those releases would be to set the undocumented system variable qaflags to 1 explode the blocks and then set it back to 0.

    You could also create a selection set and individually explode each block individually.

    P=
    AutomateCAD

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Lightbulb Re: AutoLISP Help - Code not working on all machines

    I can confirm that in 2014, you do need the 1 bitcode set in the sysvar QAFLAGS.

    Code:
    ;; I suppose you could test the value the the bitcode 1 like this, but why?
    ;; Just save the current value, set it like you want, then set it back
    ;;  (if (not (eq 1 (logand 1 (getvar "qaflags"))))
    
    ;; begin
    (setq qaflags (getvar "qaflags"))
    (setvar "qaflags" 1)
    (command ".explode" (ssget "_X" '((0 . "insert") (2 . "<blockname>"))) "")
    (setvar "qaflags" qaflags)
    R.K. McSwain | CAD Panacea |

  5. #5
    Member
    Join Date
    2006-12
    Location
    Cascais, Portugal
    Posts
    25
    Login to Give a bone
    1

    Default Re: AutoLISP Help - Code not working on all machines

    Quote Originally Posted by peter View Post
    The explode command for several releases would only allow for single items to be exploded.
    I know 2010 is like that.
    The work around for those releases would be to set the undocumented system variable qaflags to 1 explode the blocks and then set it back to 0.
    You could also create a selection set and individually explode each block individually.
    P=
    Just to share,
    from AC2010+, using the 'initcommandversion' function, we don't need to mess with 'qaflags' system variable
    i.e.
    Code:
    (defun c:demo (/ ss)
      (cond ((setq ss (ssget "_X" '((0 . "INSERT") (2 . "<blockname>"))))
             (initcommandversion)
             (command "_.explode" ss "")
            )
      )
      (princ)
    )
    Henrique

  6. #6
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: AutoLISP Help - Code not working on all machines

    Good trick, I know for me... I hadn't seen that one.

    Million ways to skin a cat in Acad.

    P=
    AutomateCAD

  7. #7
    Certified AUGI Addict cadtag's Avatar
    Join Date
    2000-12
    Location
    Cairo - no, not Illinois
    Posts
    5,069
    Login to Give a bone
    0

    Default Re: AutoLISP Help - Code not working on all machines

    if you're simply going to xref and immediately bind, why not just insert as a block?

Similar Threads

  1. Autolisp program not working
    By marexiukas365034 in forum AutoLISP
    Replies: 8
    Last Post: 2013-03-16, 02:30 AM
  2. Help interpreting autolisp code
    By ae1329 in forum AutoLISP
    Replies: 4
    Last Post: 2012-09-15, 05:21 PM
  3. Autolisp Code To Print Multiple Paperspace layout
    By mill3929974348 in forum AutoLISP
    Replies: 2
    Last Post: 2012-04-27, 09:10 PM
  4. lisp not working on some machines
    By rstiles in forum AutoLISP
    Replies: 19
    Last Post: 2010-08-11, 06:35 AM
  5. Replies: 13
    Last Post: 2004-07-29, 11:38 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
  •