acet-error-init

Dear All,

currently I'm trying to export the autocad lisps to briscad. Almost all lisps work fine except for a few who are listed with acet-error-init. Probably briscad will not work with these codes or have it wrtten in a other way. Anyone who could help?

;;;----MAKE LAYER -------;;;
(defun LayerMake (name / )
  (if (not (tblsearch "layer" name))
    (command "_.layer" "M" name "c" "white" "" "lw" "0.20" "" "") ;make layer
    (command "_.layer" "s" name "")
  )
)

;;;;---- MAKE DIMENSION -----;;;;
(defun MakeDim (dim / )
  (setvar "CMDECHO" 0)
  (acet-error-init (list (list "CLAYER" (getvar "clayer") ) 0)) ;;"DIMCLRT" 2
  (LayerMake "Dimension")  
  (setvar "CMDECHO" 1)
  (if (= dim dimensionarc)
    (dimensionarc)
    (command dim)
    )
  (while (> (getvar "cmdactive") 0)(command pause))   ;until dimlinear stopped
  (setvar "CMDECHO" 0)
  (acet-error-restore)       ;restore acad variable
  )

;;;---- Make dimlinear ----;;;;
(defun c:dli ()
  (MakeDim "_.dimlinear")
  )

Regards

Comments

  • Hello,

    (acet-*) functions are Express Tools dedicated and will not work within BricsCAD. You can simply to try comment them or replace with plain LISP codes.

    Regards, Vaidas
  • You should be able to change
    [code] (acet-error-init (list (list "CLAYER" (getvar "clayer") ) 0)) ;;"DIMCLRT" 2[/code]
    to
    [code] (setq oldclayer (getvar "clayer"))[/code]

    and

    [code](acet-error-restore) [/code]
    to
    [code](setvar "clayer" oldclayer)[/code]

    acet-error-init accepts a list of system variables to store.  It sets an error handler, clears the old system variable list used by the function, calls acet-ui-progress-done, gets the values of the variables that were passed to the function and stores them along with the value of ucsicon, sets cmdecho to 0, and may set (command "_.undo" "_begin").  For your program the return value from acet-error-init is    ("CLAYER" "power" "ucsicon" 0)   .  acet-error-restore sets (command "_.undo" "_end"), restores the stored settings, resets the error handler, sets highlight to 1, and sets cmdecho to 1.





     
  • Dear Martin, Dear All,

    many thanks for all the hints !

    I will review our (acet-error-xxx) functions, implement and/or fix the problems, so that V14
    will get working + compatible versions.

    Many greetings to all !
  • Torsten,

    I've used the acetutil.lsp that I received many years ago with a lisp extender for Autocad LT with great success.  I have many of the express tools (legally obtained when they were available for free download many years ago) working well.  I had to write replacements for acet-str-format and acet-str-find, which were implemented in arx, to get the routines I use to work.   
  • @Daniel

    The following code is similar to the acet-error-init /acet-error-restore
    [code]; CCL:GSVAR
    ; Usage:
    ; Place at the start of your routine to save environment variables, and call
    ; at the end to reset.
    ;
    ; To save environment variables present a list of the variables to save
    ; e.g. (CCL:GSVAR '(cmdecho osmode expert blipmode dimtxsty))
    ; will return a list of what they are currently set to e.g. the above will
    ; return something similar to:
    ; ((DIMTXSTY "CCL-ROMANS") (BLIPMODE 0) (EXPERT 0) (OSMODE 8706) (CMDECHO 1))

    ; To reset the variables back after running your routine simply pass
    ; something other than a list to CCL:GSVAR
    ; e.g. (CCL:GSVAR T)
    ; This will reset the list and return nil.
    ;
    ; Requires      : Nothing else
    ;------------------------------------------------------------------------------

    (defun CCL:GSVAR (varlist / e_var s_val var2reset)
     ; Make sure the visual lisp extensions are available. Required by AutoCAD
     ; Bricscad will work fine without
     (vl-load-com)
     (cond  ((= 'LIST (type varlist)) ; if you pass CCL:GSVAR a list it will save each of the variables to a list
             (setq *ccl:gsvar_list* ()) ; make sure that our global variable is reset
             (foreach e_var varlist ; for each member of our list
                    (setq s_val (list e_var (getvar (vl-symbol-name e_var))) ; retrieve its current value using GETVAR
                          *ccl:gsvar_list* (cons s_val *ccl:gsvar_list*) ; and add it to our list
                    ) ; end setq
             ) ; end foreach
            ) ; end LIST condition
            (T ; if you pass anything else it will reset each of the variables in our list
             (while *ccl:gsvar_list*
                (setq var2reset (car *ccl:gsvar_list*)) ; retrieve the first variable to reset from our list
                (setvar (vl-symbol-name (car var2reset)) (cadr var2reset)) ; reset it using SETVAR
                (setq *ccl:gsvar_list* (cdr *ccl:gsvar_list*)) ; remove the reset variable from our list
             ) ; end while
            ) ; end T reset condition
     ) ; end cond
    (if *ccl:gsvar_list* *ccl:gsvar_list* (prin1)) ; return our variable if exists, otherwise make a quiet exit
    ) ; end CCL:GSVAR[/code]

    I'm not familiar with acet-error-init /acet-error-restore, but you need to couple the function above with an appropriate error handler to make sure that variables are always reset.
    [code]; *ERROR*
    ; Error handler should anything go wrong
    (defun *error* (error_msg)
        (cond ((eq error_msg "console break")  (CCL:GSVAR T)); Console break, no message, reset environment variables
              ((eq error_msg "Function cancelled") (CCL:GSVAR T)); Function cancelled, no message, reset environment variables
              ((eq error_msg ())(CCL:GSVAR T)); error not stated, no message, reset environment variables
              (T (princ (strcat "\nERROR: " error_msg )) (CCL:GSVAR T)); Print error message if given, reset environment variables
         ); end Cond
     (prin1); exit quietly
    ) ; end *error*[/code]
    Lee Mac has a good explanation on the error function and usage on his website. http://lee-mac.com

    Both of the functions above would sit in your on_doc_load.lsp so that they are available to any functions that require it.

    An alternative approach in the specific case of your example may be to use the Toolpalette. You can define a commands on the Toolpalette to use specific layers, linetypes etc, which allows you to do pretty much the same thing without using any code.

    Regards,

    Jason Bourhill

    CAD Concepts


  • Dear Martin, Dear All,

    thanks for the hints :-)
    I'm going to add all that "acet-xxx" and "acet::xxx" stuff to BricsCAD Lisp engine;
    and I'm also going to add most of the "acet-xxx" functions from AcetUtils.arx as well ...

    So I'm optimistic to get this (mostly) done till V14 release; documentation will be also be added
    to the Lisp Developer Support Package.

    Many greetings to all !
  • @Jason Bourhill,

    thank you for your response. I now got everything to work.

    Regards,

    Daniel

  • near oll of the (acet-*)Functions are rebuilded by Torsten and me.
    I build the Expresstools (from AutoCAD) new for Bricscad. During this i had to create many,many of this acet functions.
    You can download the expresstools for bricscad (http://www.cadwiesel.de/cadwiesel/cw_download_01.php?id=230) and use the Acetutil.des for the needed functions. Here ist the list of included functions
    [code]acet-4-match
    acet-acad-refresh
    acet-alert
    acet-and-match
    acet-angle-equal
    acet-angle-format
    acet-annotation-ss
    acet-appid-delete
    acet-arxload-or-bust
    acet-arxload-or-bust
    acet-att-subscript-duplicates
    acet-autoload
    acet-autoload2
    acet-autoloadarx
    acet-blink-and-show-object
    acet-blink-and-show-object_do
    acet-blk-match
    acet-blktbl-match
    acet-block-make-anon
    acet-block-purge
    acet-bs-strip
    acet-calc-bitlist
    acet-calc-round
    acet-calc-tan
    acet-cmd-exit
    acet-currentviewport-ename
    acet-dcl-list-make
    acet-dict-ename
    acet-dict-name-list
    acet-dtor
    acet-dxf
    acet-elist-add-defaults
    ACET-ENT-CURVEPOINTS
    acet-ent-geomextents
    acet-error-init
    acet-error-restore
    acet-explode
    acet-file-attr
    acet-file-backup
    acet-file-backup-delete
    acet-file-find
    acet-file-find-font
    acet-file-find-image
    acet-file-find-on-path
    acet-filename-associated-app
    acet-filename-directory
    acet-filename-extension
    acet-filename-ext-remove
    acet-filename-path-remove
    acet-filename-supportpath-remove
    acet-filename-valid
    acet-file-open
    ACET-FILE-REMOVE
    ACET-FILE-WRITEDIALOG
    acet-filter-match
    acet-fscreen-toggle
    acet-gc-match
    acet-general-props-get
    acet-general-props-get-pairs
    acet-general-props-set
    acet-general-props-set-pairs
    acet-geom-angle-trans
    acet-geom-arc-3p-d-angle
    acet-geom-arc-bulge
    acet-geom-arc-center
    acet-geom-arc-d-angle
    acet-geom-calc-arc-error
    acet-geom-cross-product
    acet-geom-delta-vector
    acet-geom-image-bounds
    acet-geom-intersectwith
    acet-geom-is-arc
    acet-geom-list-extents
    acet-geom-midpoint
    acet-geom-mid-point
    acet-geom-m-trans
    acet-geom-object-end-points
    acet-geom-object-fuz
    acet-geom-object-normal-vector
    acet-geom-object-point-list1
    acet-geom-object-z-axis
    acet-geom-pixel-unit
    acet-geom-pline-arc-info
    acet-geom-point-inside
    acet-geom-point-rotate
    acet-geom-point-scale
    acet-geom-rect-points
    acet-geom-self-intersect
    acet-geom-ss-extents
    acet-geom-textbox
    acet-geom-unit-vector
    acet-geom-vector-add
    acet-geom-vector-d-angle
    acet-geom-vector-parallel
    acet-geom-vector-scale
    acet-geom-vector-side
    acet-geom-vertex-list
    acet-geom-view-points
    acet-geom-z-axis
    acet-geom-zoom-for-select
    acet-get-att
    acet-getvar
    acet-group-make-anon
    acet-groups-sel
    acet-groups-unsel
    ACET-HELP
    acet-init-fas-lib
    acet-init-getmenu-pos
    acet-init-placemenu
    acet-insert-attrib-get
    acet-insert-attrib-mod
    acet-insert-attrib-set
    acet-layer-locked
    acet-layer-unlock-all
    acet-list-assoc-append
    acet-list-assoc-put
    acet-list-assoc-remove
    acet-list-group-by-assoc
    acet-list-is-dotted-pair
    acet-list-isort
    acet-list-m-assoc
    acet-list-put-nth
    acet-list-remove-adjacent-dups
    acet-list-remove-duplicate-points
    acet-list-remove-duplicates
    acet-list-remove-nth
    acet-list-split
    acet-list-to-ss
    acet-lwpline-make
    acet-mod-att
    acet-not-match
    acet-or-match
    acet-pline-is-2d
    acet-pline-segment-list
    acet-pline-segment-list-apply
    acet-plines-explode
    acet-plines-rebuild
    acet-point-flat
    acet-pref-supportpath-list
    acet-rtod
    acet-safe-command
    acet-set-CmdEcho
    acet-setvar
    acet-spinner
    acet-ss-annotation-filter
    acet-ss-clear-prev
    acet-ss-drag-move
    acet-ss-entdel
    acet-ss-filter
    acet-ss-filter-current-ucs
    acet-ss-flt-cspace
    acet-ss-intersection
    acet-ss-mod
    acet-ss-new
    acet-ss-redraw
    acet-ss-remove
    acet-ss-remove-dups
    acet-ss-scale-to-fit
    acet-ss-sort
    acet-ss-ssget-filter
    acet-ss-to-list
    acet-ss-union
    acet-ss-visible
    acet-ss-zoom-extents
    acet-str-esc-wildcards
    ACET-STR-FIND
    ACET-STR-FORMAT
    ACET-STR-FORMAT2
    ACET-STR-FORMAT3
    acet-str-lr-trim
    acet-str-m-find
    ACET-STR-REPLACE
    acet-str-space-trim
    acet-str-to-list
    acet-sysvar-restore
    acet-sysvar-set
    acet-table-name-list
    acet-table-purge
    acet-tbl-match
    acet-temp-segment
    acet-tjust
    acet-tjust-keyword
    acet-truncate-2-view
    acet-ucs-cmd
    acet-ucs-get
    acet-ucs-set
    acet-ucs-set-z
    acet-ucs-to-object
    acet-ui-entsel
    acet-ui-fence-select
    acet-ui-getcorner
    ACET-UI-GETFILE
    acet-ui-get-long-name
    ACET-UI-MESSAGE
    acet-ui-m-get-names
    acet-ui-pickdir
    acet-ui-polygon-select
    acet-ui-progress-done
    acet-ui-single-select
    acet-ui-txted
    acet-undo-begin
    acet-undo-end
    acet-viewport-frozen-layer-list
    acet-viewport-lock-set
    acet-viewport-next-pickable
    acet-wmfin
    acet-xdata-get
    acet-xdata-set
    m:acet-ui-txted
    [/code]

  • Ok..... Uhhh you are good isn't enough. You are the king!! This makes life so much easier....
  • near oll of the (acet-*)Functions are rebuilded by Torsten and me.
    I build the Expresstools (from AutoCAD) new for Bricscad.


    Martin,

    Do you still intend to release your work as non-encrypted files?  You version of Express tools works well if it is the only code loaded, but there are many conflicts with the other lisp and ODCL routines I use.  Without unencrypted files it is very hard to find and fix the conflicts. 
  • Hi Martin

    The acet functions are all included in the Acetutil.des. There are also the autoload and menuload on startup included. I'll seperate all the acet functions and send it to you for testing. Than you are able to test without all expresstools functionality. But i'll keep the acet* functions compiled - sorry
    If there are faults inside the functions i'll fix this as soon.

    Many Regards
    Martin
  • Thank you for the update.
  • now i seperated the acet functions from the other stuff.
    attached is the new acetutil.des.
    I also updated the Expresstools package.
    There is now one file more inside (acettest.des), which contains the moved functions to make the tools working as bevore.
    If now somebody needs acet* functions without the Expresstools, they can take only the Acetutil.des allone.

    Please let me know if there are errors.
    use the email: cadwiesel at cadwiesel dot de

    Martin

    Acetutil.des

This discussion has been closed.