LISP

Geday all. New to BricsCAD. Still evaluating. Trying to port my old ACAD routines accross, one of which is;

^C^C^P(setq o1 (getvar "clayer"));la;t;0;s;0;;attdia;1;insert;x:/item;\(getvar "dimscale");;0;(setvar "clayer" o1)(princ);

Comes back with

Unable to recognize command "^C^C^P(SETQ". Please try again.

The routine basically inserts a block.

What needs to be done for BricsCAD to run this?

Cheers and TIA,

Mark

Comments

  • Try

    ^C^C^P(setq o1 (getvar "clayer"));._-LAYER;Thaw;0;Set;0;;ATTDIA;1;._-INSERT;BlockName;\(getvar "dimscale");;0;(setvar "clayer" o1)(princ);^P

    Don't think the issue is with "^C^C^P(SETQ". More likely due to using shortcut keys names for commands e.g. la instead of ._-Layer. Also with scripts and menus you need to be sure you use the command line version of the command otherwise you can get the dialogue version instead. Usually this is done by placing a "-" in front of the command e.g. "-Layer" "-Insert"

    Your example is a compound command set. It is running a string of different commands. To fault find it is easier to copy out string to a text editor and break the command down into its parts, then test each step seperately. e.g.

    STEP 1 Save current Layer
    (setq o1 (getvar "clayer"));

    STEP 2 Set current Layer to 0
    ._-LAYER;Thaw;0;Set;0;;

    STEP 3 turn on dialogue prompts for attributes
    ATTDIA;1;

    STEP 4 Insert Block using Dimscale as scale factor
    ._-INSERT;BlockName;\(getvar "dimscale");;0;

    STEP 5 return current layer to saved value
    (setvar "clayer" o1);

    Note I have changed the x:/item for BlockName. I wouldn't hardwire paths into your menu, instead just use the block name and make sure that it is on the Support File Search Path

    Regards,

    Jason Bourhill

    CAD Concepts

  • I would take everything after ^C^C^P and convert it to lisp rather than a hybrid of lisp and diesel.  A typical block insertion routine for me is shown below.  It is called from a toolbar button with ^C^Cinsert_240v-1ph-200a    You can put the functions in on_doc_load.lsp or in a lisp file that is loaded by on_doc_load.lsp. 

    (defun C:insert_240v-1ph-200a ()
    (setvar "cmdecho" 0)
    (setpower)
    (setq ds (getvar "dimscale"))
    (prompt "\nSelect insertion point... ")
    (command "_insert" "E_240v-1ph-200a" "PS" ds pause ds ds 0)
    (command "_explode" "_last")
    (PRINC)
    )
  • Depending which Acad version you are coming from, Bcad had changed to remain in line with changes Acad made, so such things as "la" and "insert" perhaps don't do what they used to in either.

    Try them on the command line and see if they would do what you want within list or a script.

  • Hi Mark,

    not sure how you call that line of code. But maybe this thread is of interest / help to you: https://forum.bricsys.com/discussion/15322

This discussion has been closed.