View Single Post
  #6  
Old 03-10-2018, 06:54 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 754
Re: Load sketch, choose position

Quote:
Originally Posted by tom kirkman View Post
You can add an adjustment (insert) point to your insert sketch command.
perfect! :-)
---------------
Quote:
Originally Posted by tom kirkman View Post
I am adding an example lisp. This adds change cards to a drawing. The type of change card is dependent upon the type of change. The change card always goes below the lower left hand corner of the drawing. So this program finds the drawing corners and properly places the change card.
a few LISP related remarks:
  • you don't need (OI_TOOLS:: prefix, because it is within your OWN package : (in-package :OI_TOOLS)
  • you don't need (oli:: prefix in your code, because there is (use-package :OLI)
  • I dont see the need for the global variable Eff
  • I recommend to change your ok-action and the defun to:
    Code:
    ...
    :ok-action'(sd-call-cmds (change-cards Effectivity))
    ) ;; end dialog
    
    ;defines the changed card function
    (defun change-cards (eff)
    ....
    )
    +removing the global variable Eff. This means you pass over the value of the dialog variable as parameter to the function
  • handling the corners of the sheet with string-number-string conversion looks cumbersome to me, and the conversion is not needed at all
  • within the defun you are creating a bunch of more new global variables (by accident), without the need to do so.
    Question: have you ever used a (LET (..) ...) statement?
  • you can remove your condition and generate the file name directly from the parameter:
    Code:
    (AM_LOAD_SKETCH 
    	:FILENAME (format nil "~A/ANNOTATION/Sketches/Change Card/Change-~A.mi" OICUSTDIR Eff)
    	:adjust 7
    	:PICK_PNT pick-point)
    if you are adding other cases I would ONLY generate the new (base)filename within the condition and have just one lisp call of loading sketch with the new filename.
Those are just friendly hints to perform the quality of the lisp code. I have no doubt about the functionality as it is!
Reply With Quote