Regarding:Some of Lisp File Failing to load in Autocad 2016

Regarding:Some of Lisp File Failing to load in Autocad 2016

Anonymous
Not applicable
1,174 Views
12 Replies
Message 1 of 13

Regarding:Some of Lisp File Failing to load in Autocad 2016

Anonymous
Not applicable

My lisp File is loading and Working Fine in Autocad 2014 ,The Same lisp File i loaded in AUtocad 2016.It seems to be Not working.

Prob.PNG

 

The above message came when i clicked a ribbon,which point to a lisp file,that working fine in 2014,Only in 2016 the above message came,Anyone can Please help.

 

 

Regards,

Dilipan.s

0 Likes
1,175 Views
12 Replies
Replies (12)
Message 2 of 13

hmsilva
Mentor
Mentor

@Anonymous wrote:

My lisp File is loading and Working Fine in Autocad 2014 ,The Same lisp File i loaded in AUtocad 2016.It seems to be Not working.

Prob.PNG

 

The above message came when i clicked a ribbon,which point to a lisp file,that working fine in 2014,Only in 2016 the above message came,Anyone can Please help.

 

 

Regards,

Dilipan.s


Hi Dilipan,

after you click the ribbon, if you press F2 key do you see the all the error message?

 

Using AC2015+ It is required to use command-s calls inside an error handler, instead command calls...

If you post your code, It would be easier to some of us try to assist.

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 13

Anonymous
Not applicable


(defun C:GHD_INSBLOCK (/)
(ghd_curset)
(setvar "insunits" 4)
(command
"attdia" "1"
;; "-layer" "m" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
"-color" "bylayer"
"-linetype" "s" "bylayer" "")
(searchfile (strcat GHDBLOCKNAME ".dwg"))
(prompt "\nInsertion Point: ")
(command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" "0" )
(ghd_prevset)
)

(defun C:GHD_INSBLOCK_ROT (/)
(ghd_curset)
(setvar "insunits" 4)
(command
"attdia" "1"
;; "-layer" "m" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
"-color" "bylayer"
"-linetype" "s" "bylayer" "")
(searchfile (strcat GHDBLOCKNAME ".dwg"))
(prompt "\nInsertion Point: ")
(command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" pause )
(ghd_prevset)
)

(defun C:GHD_INSBLOCK_TX50 (/)
(ghd_curset)
(setvar "insunits" 4)
(command
"attdia" "1"
;; "-layer" "m" ghd_laynam "c" "1" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
"-color" "bylayer"
"-linetype" "s" "bylayer" "")
(searchfile (strcat GHDBLOCKNAME ".dwg"))
(prompt "\nInsertion Point: ")
(command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" "0" )
(command "explode" "l" "ddedit" "l" "" "chprop" "l" "" "la" ghd_laynam "")
(ghd_prevset)
)

(defun C:GHD_INSBLOCK_TX35 (/)
(ghd_curset)
(setvar "insunits" 4)
(command
"attdia" "1"
;; "-layer" "m" ghd_laynam "c" "2" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
"-color" "bylayer"
"-linetype" "s" "bylayer" "")
(searchfile (strcat GHDBLOCKNAME ".dwg"))
(prompt "\nInsertion Point: ")
(command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" "0" )
(ghd_prevset)
)

(princ)

 

 

 

 

 

 

 

 

 

 

 

This is my lisp file

 

Regards,

Diliapn.S

0 Likes
Message 4 of 13

hmsilva
Mentor
Mentor

I would suggest to remove the ATTDIA setting from the command call and use a (setvar 'ATTDIA 1), but the error message should refer to (ghd_curset) or (ghd_prevset) functions...

 

Henrique

EESignature

0 Likes
Message 5 of 13

Anonymous
Not applicable

HI Silva,
Thanks For Replying,I try that and  Inform u.


Regards,
Dilipan.S

0 Likes
Message 6 of 13

Anonymous
Not applicable

I changed as u said,

 

Same status now showing Different Error Now

 

After chaning Same status,its working in Acad 2014,but not in Acad 2016.

 

 

In 2014

 

In Acad2014.JPG

 

 

 

In 2016

 

In 2016.JPG

 

 

 

Regards,

Dilipan.S

0 Likes
Message 7 of 13

hmsilva
Mentor
Mentor

@Anonymous wrote:

I changed as u said,

...


Dilipan, could you please post the modified code?

 

Henrique

EESignature

0 Likes
Message 8 of 13

Anonymous
Not applicable
Hi Silva,

The same above code only,I just Replaced ATTDIA with (setvar 'ATTDIA 1)

For ur Information I m not a lisp Programmer.I m a .net Auto-cad Api developer.So I m struggling with this

Regards,
Dilipan.S
0 Likes
Message 9 of 13

hmsilva
Mentor
Mentor

The revised code should be something like this

 

(defun C:GHD_INSBLOCK (/)
    (ghd_curset)
    (setvar "insunits" 4)
    (setvar 'attdia 1) ; <- add by me
    (setvar 'cecolor "BYLAYER") ; <- add by me
    (setvar 'celtype "BYLAYER") ; <- add by me
    ;|(command
	"attdia"
        ;; "-layer" "m" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
        "-color" "bylayer" "-linetype" "s" "bylayer" "")<- commented by me |;
    (searchfile (strcat GHDBLOCKNAME ".dwg"))
    (prompt "\nInsertion Point: ")
    (command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" "0")
    (ghd_prevset)
)
(defun C:GHD_INSBLOCK_ROT (/)
    (ghd_curset)
    (setvar "insunits" 4)
    (setvar 'attdia 1) ; <- add by me
    (setvar 'cecolor "BYLAYER") ; <- add by me
    (setvar 'celtype "BYLAYER") ; <- add by me
    ;|(command
        "attdia" "1" 
        ;; "-layer" "m" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
        "-color" "bylayer" "-linetype" "s" "bylayer" "")<- commented by me |;
    (searchfile (strcat GHDBLOCKNAME ".dwg"))
    (prompt "\nInsertion Point: ")
    (command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" pause)
    (ghd_prevset)
)
(defun C:GHD_INSBLOCK_TX50 (/)
    (ghd_curset)
    (setvar "insunits" 4)
    (setvar 'attdia 1) ; <- add by me
    (setvar 'cecolor "BYLAYER") ; <- add by me
    (setvar 'celtype "BYLAYER") ; <- add by me
    ;|(command
 	"attdia" "1"
        ;; "-layer" "m" ghd_laynam "c" "1" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
        "-color" "bylayer" "-linetype" "s" "bylayer" "")<- commented by me |;
    (searchfile (strcat GHDBLOCKNAME ".dwg"))
    (prompt "\nInsertion Point: ")
    (command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" "0")
    (command "explode" "l" "ddedit" "l" "" "chprop" "l" "" "la" ghd_laynam "")
    (ghd_prevset)
)
(defun C:GHD_INSBLOCK_TX35 (/)
    (ghd_curset)
    (setvar "insunits" 4)
    (setvar 'attdia 1) ; <- add by me
    (setvar 'cecolor "BYLAYER") ; <- add by me
    (setvar 'celtype "BYLAYER") ; <- add by me
    ;|(command
 	"attdia" "1" 
        ;; "-layer" "m" ghd_laynam "c" "2" ghd_laynam "" ;layer set by calling GHD_TEXT_LAYER.lsp (CAM)
        "-color" "bylayer" "-linetype" "s" "bylayer" "")<- commented by me |;
    (searchfile (strcat GHDBLOCKNAME ".dwg"))
    (prompt "\nInsertion Point: ")
    (command "-insert" (strcat CAMS_CLIENTPATH GHDBLOCKNAME) pause (* 1 SCALE) "" "0")
    (ghd_prevset)
)
(princ)

 

 

In these four commands, the code calls three external functions that are defined in another place/code, they are:
ghd_curset, searchfile and ghd_prevset

Most likely one/more than one of those external functions is generating the error in AC2016, you'll have to search the file in which these functions are defined to replace the command call to a command-s...

 

Henrique

EESignature

0 Likes
Message 10 of 13

Anonymous
Not applicable
Hi silva,
Thanks for ur Faster Response .

I m going to Change nearly 500 lisp Files ,all maximum contains this ghd_curset,
function can i Replace all Command to Command-S,Whether Its a correct Way?

Thanks&Regards,
Dilipan.S
0 Likes
Message 11 of 13

dbroad
Mentor
Mentor

@Anonymous

 

It doesn't appear that you are defining an *error* function in your code.  Since that is probably the case, it is safe to assume that the code errors are coming from somewhere else. 

 

You can test to see if it is your code by just cause an error at the command line.

 

(/ 2 0) ;should do it.

 

If you see the same message, then  it is probably caused by code somewhere else.  I suggest that you redefine the *error* handler as;

 

(defun *error* (msg) (if msg (princ msg)(princ));;The simplest error handler

 

or delete the errant error handler by just

 

(setq *error* nil)

 

In ACA 2015, the problem was caused by a poorly written LSP file written by an Autodesk developer.  Hot fixes and service packs should take care of it.  Make sure you are up-to-date with those.

 

To insulate your code from any rogue error handler, just declare the *error* variable local in your functions.

 

(defun blahblahblah ( your arguments / *error* your local vars)  blah blah blah )

 

In case this helps, I am posting the problem file from 2015.  It should be safe for you to replace that file in your installation.

Your last error message means that there is a missing external file as hmsilva indicated.

 

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 12 of 13

dbroad
Mentor
Mentor

@Anonymous

 

It doesn't appear that you are defining an *error* function in your code.  Since that is probably the case, it is safe to assume that the code errors are coming from somewhere else. 

 

You can test to see if it is your code by just cause an error at the command line.

 

(/ 2 0) ;should do it.

 

If you see the same message, then  it is probably caused by code somewhere else.  I suggest that you redefine the *error* handler as;

 

(defun *error* (msg) (if msg (princ msg)(princ));;The simplest error handler

 

or delete the errant error handler by just

 

(setq *error* nil)

 

In ACA 2015, the problem was caused by a poorly written LSP file written by an Autodesk developer.  Hot fixes and service packs should take care of it.  Make sure you are up-to-date with those.

 

To insulate your code from any rogue error handler, just declare the *error* variable local in your functions.

 

(defun blahblahblah ( your arguments / *error* your local vars)  blah blah blah )

 

In case this helps, I am posting the problem file from 2015.  It should be safe for you to replace that file in your installation.

 

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 13 of 13

hmsilva
Mentor
Mentor

@Anonymous wrote:
Hi silva,
Thanks for ur Faster Response .

I m going to Change nearly 500 lisp Files ,all maximum contains this ghd_curset,
function can i Replace all Command to Command-S,Whether Its a correct Way?

Hi Dilipan,

you don't have to change the 500 .lsp files...

I did ask you to find the ghd_curset (and the others) function to see if it have an error handler in it...

 

Henrique

EESignature

0 Likes