Autocad vs Bricscad lisp

 Hi,
I have new client who start using Bricscad. He have lisp files that was using in Autocad.
Can anybody say why this code works correctly on autocad but not in bricscad?


Thank you!

(DEFUN C:PIKA ()
(SETVAR "DIMZIN" 4)
(PROMPT "SELEKTIRAJ LINIJE: ")
(SETQ S (SSGET '(( 0 . "LINE"))))

(SETQ BR (SSLENGTH S)
      I 0 )
(WHILE (< I BR)
(SETQ Y (CDR (ASSOC 10 (ENTGET (SSNAME S I)))))
(SETQ Y1 (CDR (ASSOC 11 (ENTGET (SSNAME S I)))))
(SETQ T1 (MAPCAR '+ Y '(0.2 0.2))
 T2 (MAPCAR '- Y '(0.2 0.2)))
(IF (= (AND (SSGET "C" T1 T2 '((0 . "POINT")))) nil)
(PROGN
(COMMAND "POINT" Y "")
));IF
(SETQ T1 (MAPCAR '+ Y1 '(0.2 0.2))
 T2 (MAPCAR '- Y1 '(0.2 0.2)))
(IF (= (AND (SSGET "C" T1 T2 '((0 . "POINT")))) nil)
(PROGN
(COMMAND "POINT" Y1 "")
));IF
(SETQ I (+ I 1))
);WHILE
);DEFUN

Comments

  • Try deleting empty lines after (SETQ S (SSGET '(( 0 . "LINE"))))
  • You're more likely to get assistance if you describe the problem, i.e. what do you expect to happen, and what actually happens.

  • By default the _Point command is not a repetitive command in BricsCAD (but there is a _Multiple option).
    So:
    (COMMAND "POINT" Y "")
    Should be:
    (COMMAND "POINT" Y)

    Some other potential issues:
    1.
    The PDMODE setting can be such that points are not clearly visible (PDMODE=0) or invisible (PDMODE=1).
    2.
    Since command calls are used the current value of OSMODE has an impact on the result.
    To avoid this you can use:
    (command "_.point" "_non" pt)
  • Also under AutoCAD (at least since version 2008 - but likely even 2002/2004) the POINT command is not repetitive, when used with (command ...);
    this is, as Autodesk correctly tries to keep backward compatibility for existing code.

    Hence, that client sample code must be very old (meaning, used with very old AutoCAD versions) - with AutoCAD >= 2008 it will fail as well.
    So Roy is perfectly correct ... and as he mentioned, disabling object snap is mandatory when using (command ....).

    Can be done by (setvar "OSMODE" 0) ...

    Final hint : never use plain English command names - always use "_" underscore prefixed command names + option;
    (command "_point" ...) or (command "_layer" "_make" ... "_color" ...) and so on ...
    otherwise the Lisp code will quickly fail on non-English BricsCAD versions ...

    many greetings !
  •  Thank you all!

    Problem is :

    (COMMAND "POINT" Y "") 
    Should be: 
    (COMMAND "POINT" Y) 
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!