Message 1 of 7

Not applicable
08-09-2018
01:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So here's some code that actually does exactly what I want.
(VL-LOAD-COM) (DEFUN C:RSFIND ( / PLEN CNTR PLENGTH PWIDTH SSVAL FINDLENGTH PTMP PANEL_LIST) (SETQ PLENGTH (GETDIST "What is Panel length: ")) (SETQ PWIDTH (GETDIST "What is Panel Width: ")) (SETQ SSVAL (SSGET '((8 . "RS Panels")))) (SETQ FINDLENGTH (+ (* PLENGTH 2.0) (* PWIDTH 2.0))) ;;;;;;;;;;;;;;;;;;;;;;; ;;;Typical vla-setup;;; ;;;get length and ;;; ;;;highlight ;;; ;;;;;;;;;;;;;;;;;;;;;;; (DEFUN VSET (CNTR SSVAL / ENTOBJ VLAENT) (SETQ ENTOBJ (SSNAME SSVAL CNTR)) ;;GET <E> NAME FROM COUNTER LOCATION IN SELECTION SET (SETQ VLAENT (VLAX-ENAME->VLA-OBJECT ENTOBJ)) ;;STORE OBJECT DATA FROM ENTITY (SETQ PLEN (VLAX-GET-PROPERTY VLAENT 'Length)) (COND ((= PLEN FINDLENGTH) (VLA-HIGHLIGHT VLAENT :VLAX-TRUE)) (T NIL) ) ) ;;;;;;;;;;;;;;;;;;;;;;; ;;;step through list;;; ;;;;;;;;;;;;;;;;;;;;;;; (COND ((/= SSVAL NIL) (SETQ CNTR 0) (WHILE (< CNTR (SSLENGTH SSVAL)) (VSET CNTR ssval) (SETQ CNTR (+ 1 CNTR)) ) ) (T NIL) ) (PRINC) )
THE PROBLEM:
When I run "Check in Text Editor:"
[CHECKING TEXT RFIND (2.0).lsp loading...] .. ; === Top statistic: ; Global variables: (:vlax-true FINDLENGTH PLEN) ; Function definition (with number of arguments): ((VSET . 2) (C:RSFIND . 0)) ; Check done.
Those non-vlax variables return nothing after the script is finished running. I assume :vlax-true returns :vlax-true every single time. When I include "FINDLENGTH, PLEN, & :vlax-true" in my local declaration for subfunciton (VSET), I don't get the desired output. . . Which is just highlighting rectangles that equal the length I'm looking for(Job specific).
Does having the three variables considered "GLOBAL" in this case matter? I don't think it does, but I'd like to ask you guys before implementing this script in my daily routine.
Thanks for the help.
Thaddeus
Solved! Go to Solution.