Jump to content

Beginner trying to use LDATA : Having trouble retreving setq


Recommended Posts

Posted

Here is the way it worked before

;;(setq JOBN (getstring (strcat "\n<ENTER JOB NAME>  " (cond (JOBNANS) ("CUSTOMER")) " "))
;;    JOBNANS (cond ((/= JOBN "") (strcase JOBN)) (JOBNANS) ("CUSTOMER"))
;; )
(COMMAND "TEXT" "J" "R" TXT5 "1.000" "0" JOBNANS)

 

This is what im trying now but cannot get the  JOBANS to work in the text command

 

(setq JOBN (vlax-ldata-get "4PAN" "JOBN"))
(if (= JOBN nil) (setq JOBN "CUSTOMER"))              
(if (= "" (setq JOBANS (getstring (strcat "\nENTER JOB NAME [" JOBN "]: "))))
(setq JOBANS JOBN)                                  
)
(vlax-ldata-put "4PAN" "JOBN" JOBANS)

 

 

 

 

Posted (edited)

Guessing you looked at this?

The only thing wrong is calling the wrong variable. you have an extra N in the text command. either change that or the ldata to match

 

(COMMAND "TEXT" "J" "R" TXT5 "1.000" "0" JOBNANS) ;needs to be JOBANS 

 

Its good practice to use "_non" in front point values (txt5) so if you have snaps on it could jump to something near.

 

 

Edited by mhupp
  • Thanks 1
Posted

Thank you.. Yes I got the idea from that other post. If I was using the visual Lisp editor would that have been easier to spot? I gotta force myself to learn how to use it. I still do the note pad thing.  Thanks for the tip on the "_non" on point values I will try that now. This is what I been doing to negate the bad picks.

(SETQ OSM (GETVAR "OSMODE")
      SNM (GETVAR "SNAPMODE")
      ORM (GETVAR "ORTHOMODE")
       CL (GETVAR "CLAYER")
      DPL (GETVAR "DIMDEC")
      DMS (GETVAR "DIMSCALE")
      DTX (GETVAR "DIMTXT")
      DUT (GETVAR "DIMUNIT")
      DTS (GETVAR "DIMTXSTY")
      ECO (GETVAR "CMDECHO")
      CYC (GETVAR "SELECTIONCYCLING")
)

 

Posted (edited)

In all honesty didn't see it until i pasted it into notepad++. its a better notepad and you can get a lisp plug in for it.

also look into Visual Studio its has even more featurs then notepad++  but can be a bit overwhelming.

 

image.thumb.png.fe50f3588d8fe22e08a39fb98eed05bd.png

 

If your inputting the same customer I suggest use the second code. It will save and remember the last input between drawings.

 

(or (setq JOBN (getenv "4PAN")) (setq JOBN "CUSTOMER")) ;looks for JOBN in registry if not found sets it to Customer 
(if (= "" (setq a (getstring (strcat "\nENTER JOB NAME [" JOBN "]: "))))
  (setq a JOBN) ;if you hit enter it will set a to dia value else override it to what you input
)
(setenv "4PAN" JOBN)

 

Edited by mhupp
added a suggestion
  • Thanks 1
Posted

I tested both ways. Unless im crazy lol. its possible. When I tested Idata it would save the info in the drawing I ran the program from over and over & then the next time i opened the drawing & fired off the program it remembered.  -Ok im not Crazy i just did a fresh test. I saved the drawing, closed autocad, reopened the drawing and the variable held.

 

When i did the registry method, It remembered it in any new drawing I opened, Little Nervous of corrupting all drawing files.

 

How do I remove a variable from the registry?

Posted (edited)
9 minutes ago, SIMPLYCRAZY said:

I tested both ways. Unless im crazy lol. its possible. When I tested Idata it would save the info in the drawing I ran the program from over and over & then the next time i opened the drawing & fired off the program it remembered.  -Ok im not Crazy i just did a fresh test. I saved the drawing, closed autocad, reopened the drawing and the variable held.

 

When i did the registry method, It remembered it in any drawing I opened, Little Nervous of corrupting all drawing files.

 

How do I remove a variable from the registry?

if I enter this in any drawing I get the value I set (getenv "cirdia")    from other example

Edited by SIMPLYCRAZY
Posted
9 minutes ago, SIMPLYCRAZY said:

How do I remove a variable from the registry?

 

I'm not quit sure of the command but you can use regedit to go and delete it manually.

 

 

 

 

 

 

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...