Code Red > AutoLISP (Vanilla / Visual)
Difference in LISP functionality ACAD & BricsCAD
mailmaverick:
Dear Friends,
I have transitioned from AutoCAD to BricsCAD (due to exorbitantly high pricing of AutoCAD) and have noticed certain disparities in the LISP functionality between the two software packages. Consequently, we need to make adjustments to our LISP code. I have listed some of the differences I've identified below. I propose that this thread serves as a platform for compiling similar observations made by others. This way, we can proactively identify areas in the code that require modification, rather than encountering errors and then troubleshooting them.
1.) In BricsCAD, vl-sort works fine as
--- Code: --- (vl-sort blklist '(lambda (a b) (< (car a) (car b))))
--- End code ---
but does not work with
--- Code: --- (vl-sort blklist '(lambda (e1 e2) (= (car (SortStringWithNumberAsNumber (list (car e1) (car e2)) T)) (car e1))))
--- End code ---
Whereas in AutoCAD, vl-sort works fine with SortStringWithNumberAsNumber function.
2.) initcommandversion available in AutoCAD but not in BricsCAD.
3.) SafeArray with No Objects returns SafeArray in AutoCAD but returns nil in BricsCAD
--- Code: --- (setq OProps (vlax-variant-value (vla-GetDynamicBlockProperties BlockObj)))
--- End code ---
returns a Safearray of Zero Length in AutoCAD but returns NIL in BricsCAD. This is important because next line
--- Code: --- (setq i (vlax-safearray-get-l-bound oProps 1))
--- End code ---
works fine in AutoCAD but in BricsCAD this line returns error.
4.) Making LineType
In AutoCAD following code works :
--- Code: --- (command "_.-linetype" "_l" "*" linFile)
--- End code ---
whereas in BricsCAD, it has to be modified to
--- Code: --- (command "_.-linetype" "_l" "*" linFile "Y" "Y" "Y" "Y" "")
--- End code ---
5.) AutoCAD has Hatch Pattern files named "acad.pat" & "acadiso.pat" whereas BricsCAD has filenames as "default.pat" & "iso.pat"
6.) AutoCAD has printer configuration named "DWG to PDF.pc3" whereas BricsCAD has "Print As PDF.pc3" .
All members are requested to post other differences in this thread.
Marc'Antonio Alessi:
--- Quote from: mailmaverick on September 15, 2023, 01:16:53 AM ---4.) Making LineType
In AutoCAD following code works :
--- Code: --- (command "_.-linetype" "_l" "*" linFile)
--- End code ---
whereas in BricsCAD, it has to be modified to
--- Code: --- (command "_.-linetype" "_l" "*" linFile "Y" "Y" "Y" "Y" "")
--- End code ---
--- End quote ---
--- Code: ---; Function: ALE_Layer_LoadLinetype - Alessi Marc'Antonio
;
; Version 1.00 - 16/11/2006
;
; Arguments:
; VlaDoc: IAcadDocument: An AutoCAD drawing or IAxDbDocument: Interface
; LTpCol: LineType Collection
; LtpNam: Linetype name [STR]
;
; Return Values: [VLA-OBJECT] or nil if vla-load fails
;
; Example:
; (or *AcadApp* (setq *AcadApp* (vlax-get-Acad-Object) ))
; (or *AcAcDwg* (setq *AcAcDwg* (vla-get-ActiveDocument *AcadApp*)))
; (or *AcLnTps* (setq *AcLnTps* (vla-get-Linetypes *AcAcDwg*)))
;
; (ALE_Layer_LoadLinetype *AcAcDwg* *AcLnTps* "Divide")
;
(defun ALE_Layer_LoadLinetype (VlaDoc LTpCol LtpNam / VrtVal)
(cond
( (ALE_Utl_GetItem LTpCol LtpNam) )
( (vl-catch-all-error-p
(vl-catch-all-apply
'vla-load
(list
LTpCol
LtpNam
(cond
( (vl-catch-all-error-p (setq VrtVal (vl-catch-all-apply 'vla-getvariable (list VlaDoc "MEASUREINIT"))))
"acadiso.lin" ; load linetype from metric linetype file if VlaDoc is a IAxDbDocument: Interface
) ; because getvariable it is not a property of a ODbx Document
( (zerop (vlax-variant-value VrtVal));English or metric
"acad.lin" ; load linetype from english linetype file
)
( "acadiso.lin" ); load linetype from metric linetype file
)
)
)
)
(alert (strcat "Asso message:\nLinetype '" LtpNam "' not found in Acadxxx.lin" ))
)
( (ALE_Utl_GetItem LTpCol LtpNam) )
)
)
; Function: ALE_Utl_GetItem
;
; Arguments:
; VlaCol = Collection Object > ex. (vla-get-Layers VlaDoc)
; KeyNam = String > "0"
;
; Return Values:
; VLA-OBJECT or nil if (vla-item) fails
;
; Note:
; the Item method is case-sensitive when used with the SelectionSets
; collection it is not case-sensitive for other collections.
;
; Example:
; (ALE_Utl_GetItem
; (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))
; "0"
; )
;
(defun ALE_Utl_GetItem (VlaCol KeyNam / VlaObj)
(vl-catch-all-apply
'(lambda ( )
(setq VlaObj (vla-item VlaCol KeyNam))
)
)
VlaObj
)
--- End code ---
Lee Mac:
Or Load Linetypes
mailmaverick:
Thanks dear friends for your wonderful codes for Linetypes.
Kindly post other differences that you have observed in the functionality of AutoCAD and BricsCAD.
dexus:
Are you sure about point 7?
An empty string returns true in AutoCAD as well.
8.) I know BricsCAD counts the amount of undo's differently. I'm not sure what is different, but Marko uses it in his code here, so he might be able to explain.
Navigation
[0] Message Index
[#] Next page
Go to full version