Jump to content

Help with behavior of INSERT command in LISP routines...


lamensterms

Recommended Posts

Hey guys,

 

Hopefully this will be an easy one for some of you...

 

I've got a LISP routine as below, and on my machine at work it behaves perfectly as shown. But on one of my colleagues machines, the "INSERT" command call will initiate the INSERT dialogue box.

 

I'm aware that it is possible to bypass the dialogue and use the command prompt version of the command by prefixing with a hyphen, but I was just wondering if someone could explain the different behavior between our 2 machines. Is there a system variable which controls this?

 

(Defun c:AH ()
(SETVAR "ORTHOMODE" 0)
(SETQ AHSCALE (GETVAR "DIMSCALE"))
(SETQ AHDSTYLE (GETVAR "DIMSTYLE")) 
(command "-layer" "set" "PS_DIM" "")
(command "-dimstyle" "restore" "PDC_PROSTEEL")
(command "dimscale" AHSCALE)
(SETQ AHPT1 (GETPOINT "\nPick Leader Insertion Points... "))
(SETQ AHPT2 (GETPOINT AHPT1))
(COMMAND "QLEADER" AHPT1 AHPT2 NIL)
(SETQ FIRSTLEADER (SSGET "L"))
(SETVAR "ORTHOMODE" 1)
(SETQ AHPT3 (GETPOINT AHPT2 "\nSpecify Note Orientation... "))
(SETQ AHQTY (GETINT "\nEnter Quantity of Holes : "))
(SETQ AHdia (getstring "\nEnter Diameter of Holes (Include slot length if applicable) : " XX))
   (INITGET "H S h s")
       (setq ahht (cond ( (getkword "\nChoose hole type [Hole/Slot]: ") ) ( "H" )))                
   (COND 
       ((EQ ahht "H")
       (SETQ AHHQ (if (> AHQTY 1) " HOLES" " HOLE")))
       ((EQ ahht "S")
        (INITGET "C O N c o n")
           (setq ahST (cond ( (GETKWORD "\nSlot measurement < Center-Center / OverAll / Neither >:  ")) ( "N" )))
        (COND 
           ((EQ ahST "C")
           (SETQ AHHQ (if (> AHQTY 1) " C/C SLOTS" " C/C SLOT")))
           ((EQ ahST "O")
           (SETQ AHHQ (if (> AHQTY 1) " O/A SLOTS" " O/A SLOT")))
           ((EQ ahST "N")
           (SETQ AHHQ (if (> AHQTY 1) " SLOTS" " SLOT"))))
       ))
(setq ahnote (strcat (ITOA AHQTY)"-%%C"AHdia AHHQ))
(SETQ AHANG (RTD (ANGLE AHPT2 AHPT3)))
[b]  (IF (= 0 AHANG) (COMMAND "INSERT" "holenote_M" AHPT2 AHSCALE "" "" ahnote "" "" "" "" ""))
 (IF (= 180 AHANG) (COMMAND "INSERT" "holenoteO_M" AHPT2 AHSCALE "" "" ahnote "" "" "" "" ""))[/b]
(SETQ AHPT1 (POLAR AHPT1 (ANGLE AHPT1 AHPT2) (/ (ATOI AHdia) 2)))
(COMMAND "QLEADER" AHPT1 AHPT2 NIL)
(COMMAND "ERASE" FIRSTLEADER "")
(command "-dimstyle" "restore" "MW_STD" "dimscale" AHSCALE)
(princ)
)

 

Thanks a lot for any help.

Link to comment
Share on other sites

Seems that your block has attributes; if, by any chance, is about the dialog for attributes input, then it may be suppressed by ATTREQ system variable.

Link to comment
Share on other sites

Hi Mircea,

 

Thanks for the reply.

 

The block does indeed have attributes, but it is not the "Enter Attributes" dialogue box (controlled by ATTREQ & ATTDIA) that appears. With ATTREQ set to 1 and ATTDIA set to 0, the routine behaves as intended on my machine, but with the same system variable settings for the other computer, we are prompted with the 'insert' dialogue box.

 

I thought it might have been either the FILEDIA or CMDDIA sysvars, but they are both set the same on both machines, and they do not affect the routine.

 

Thanks again.

Link to comment
Share on other sites

Hi Tharwat,

 

Thanks also for the reply. I'm pretty sure the ATTREQ & ATTDIA sysvars are not the offenders in this case. We have both sysvars set to the same value on both machines, and the routine produces varied results.

Link to comment
Share on other sites

Hi Tharwat,

 

Thanks also for the reply. I'm pretty sure the ATTREQ & ATTDIA sysvars are not the offenders in this case. We have both sysvars set to the same value on both machines, and the routine produces varied results.

 

I am sorry , I had to delete my previous late reply after seeing your reply in the same regard .

 

Try to add the following function before the insert command call .

 

(initcommandversion 1)

Link to comment
Share on other sites

Hey Tharwat,

 

No worries on the post timing, I just figured we may have replied at the same time.

 

I will certainly try out the (initcommandversion 1) setting.

 

Have you any idea what might be causing the difference between the 2 machines? Why would one machine require the (initcommandversion 1) setting, and another not?

 

Thanks again.

Link to comment
Share on other sites

Have you any idea what might be causing the difference between the 2 machines? Why would one machine require the (initcommandversion 1) setting, and another not?

 

Not that certain but I think with every new release the behavior of existing command calls may change so when a command being used in a Lisp routine they may not behave as it is in previous versions .

 

Try to get used to localizing variables to avoid any odd conduct from your lisp routine that may let you be wondering for so long . :)

Link to comment
Share on other sites

They're just making sure we are awake haha.

 

Both machines are running the same version, and the installations should be almost identical. I just quizzed my colleague about whether or not the routine had worked correctly before today, and he said it was working fine this morning. I think there may have been a setting change without his knowledge.

 

Ps, this is not the first time I have had this routine behave like this, but I can't remember how I overcame the issue last time.

Link to comment
Share on other sites

Hey Bhull1985,

 

Thanks for the reply. Using "-INSERT" would solve the problem. But I am really just trying to find out why "INSERT" works fine on my machine, but not my co-workers.

Link to comment
Share on other sites

You've got something in place to suppress the dialogs on your machine that isn't the same on your co-workers machines.

Do a google search for "loaded lisp in autocad" and you can probably find out what's running on your machine that isn't on theirs.

Typical for lispers to have a few "extra" tools

Link to comment
Share on other sites

Thanks Bhull1985,

 

Up until the morning the issue started, our machines should have been set up identically (or as close to identical as possible).

 

The solution I found was to simply reset AutoCAD to its default settings. After this I restored/migrated all the menus and settings from my machine to my co-worker's and now everything is working OK (for the time being).

 

Thanks for all your help guys. I really appreciate it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...