LISP in MSCAD2005

Discussion of MicroSurvey CAD related issues and questions.

Moderators: Brian Sloman, Jason Poitras, James Johnston

LISP in MSCAD2005

Postby cathy » Wed Jun 07, 2006 11:21 am

HI,

I used some little simple lisp routines in MSCAD2002, but now they do not work in 2005. Can anyone help e out with how to change it so that they work? I keep getting and error message saying the lisp routines are transparent. I have listed one below, which is just supposed to turn hatching to red without having to change the properties every time. Any help would be appreciated. Thanks.


(princ "\nLoading Custom Offset Routine ")
(setvar "cmdecho" 1)
(defun c:rhatch()
(command "bhatch")
(setq ss (ssget "_L"))
(if (/= ss nil)
(progn
(command "chprop" ss "" "c" "red" "")
)
)
)
(princ)
cathy
 
Posts: 5
Joined: Wed Jun 07, 2006 11:19 am

Postby cathy » Thu Jun 08, 2006 6:21 am

Actually the one that I posted above works except it does not turn the hatching red. This one returns a "Transparent error"

(DEFUN C:BLINE ()
;
; Suppress the command line echo
;
(SETVAR "CMDECHO" 0)
;
; Prompt the user for the name of the block to insert
;
(SETQ BNAME (GETSTRING "BLOCK NAME: "))
;
; Print a newline to clear the command line
;
(TERPRI)
;
; Prompt the user for the first insertion point
;
(SETQ P1 (GETPOINT "FROM POINT: "))
;
; Print a newline
;
(TERPRI)
;
; Prompt the user for the end of the insertion line
;
(SETQ P2 (GETPOINT "TO POINT: "))
;
; Print a newline
;
(TERPRI)
;
; Find the distance from first to second point
;
(SETQ PDIST (DISTANCE P1 P2))
;
; Find the angle in radians from the first to the second point
;
(SETQ PANG (ANGLE P1 P2))
;
; Prompt for the distance between each successive block insertion
;
(SETQ IDIST (GETDIST P1 "OFFSET DISTANCE: "))
;
; Divide the total distance to cover by the distance between each
; block and convert that value to an integer
;
(SETQ INUM (FIX (/ PDIST IDIST)))
;
; Set the counter to 0
;
(SETQ COUNT 0)
;
; As long as the counter is less than the total number of blocks
; to insert...
;
(WHILE (< COUNT INUM)
;
; Insert the block at P1 with an X scale of 1, a Y scale of 1, and
; a rotation equal to the angle between P1 and P2
;
(COMMAND "INSERT" BNAME P1 "1" "1" PANG)
;
; Set the next insertion point
;
(SETQ P1 (POLAR P1 PANG IDIST))
;
; Increase the counter by 1 and repeat the "While" loop
;
(SETQ COUNT (1+ COUNT))
)
)
cathy
 
Posts: 5
Joined: Wed Jun 07, 2006 11:19 am

Postby cathy » Thu Jun 08, 2006 6:32 am

Okay actually that one works too, but it doesn't rotate the blocks to the line....there's a little something wrong with each of them.....not sure how to fix it. I'll try to post one of those transparent error ones....
cathy
 
Posts: 5
Joined: Wed Jun 07, 2006 11:19 am

Postby Glen Cameron » Fri Jun 09, 2006 8:13 am

I had a programmer take a look at the lisp routines you posted and he found a few things of note:

The same lisp routines do not run in AutoCAD - in other words they do the same thing in MSCAD and AutoCAD.

The older MSCAD used a different CAD engine and obviously it handled the command structure of the lisp routines in a different fashion than both AutoCAD and IntelliCAD (which is what we use in MSCAD2005).

Some of what you want to do may no longer work in MSCAD2005 or would need to be rewritten. Some lisp routines may also need to be split into two and run seperately, so as to not have the CAD engine running two commands at the same time (2 commands called from the lisp routine but being processed at the same time, does not work and may be the source of the Trasnparent issue you mentioned).

Most of this programming stuff is over my head being I am not a programmer - so if a lisp programmer out there has any additional comments or information, please feel free to step up to the plate and add to the conversation.

Cheers,
Glen W. Cameron, C.E.T.
City of North Bay, Ontario
Glen Cameron
 
Posts: 1395
Joined: Fri Nov 08, 2002 12:18 pm
Location: Corbeil, Ontario, Canada


Return to MicroSurvey CAD

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron