Using Extrim in a lisp function not manually
Inside the Express tools is Etrim a great trim function. In Acad the Extrim.lsp is all exposed but errors when used in Bricscad, with a missing function.
Ok if you have express tools loaded you just need to type EXTRIM select a cutting object then a side for cut. Inside lisp you can also run Extrim by the following.
(setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-sendcommand acdoc "extrim !ent !cpt ")
Full test code
;Bricscad
(defun c:wowxx ( / ent cpt acdoc x)
(setvar 'pdmode 34)
(if (= acdoc nil)
(setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
)
(setq ss (ssget (list (cons 0 "LWPOLYLINE"))))
(repeat (setq x (sslength ss))
(setq ent (ssname ss (setq x (1- x))))
(setq cpt (osnap (vlax-curve-getStartPoint (vlax-ename->vla-object ent)) "gcen"))
(command "point" cpt)
(vla-sendcommand acdoc "extrim !ent !cpt ")
)
(princ)
)
(C:wowxx)
In this mage can see the points made but only one rectang is cut.
If you run the ssname and get a single entity and cpt and repeat that part of the code it all works. I am not sure if problem is calling EXTRIM each time. One thing I did discover is you can call it after using at least once with (etrim ent cpt) in Acad you (load "extrim") then use the defun method.
I contacted support but got only a part answer the second part was if you have a maintenance agreement we will help more. I am on V25 and at moment do not intend going to V26. The express tools are loacted in Express directory and are DES files.
Comments
-
Hello.
You could experiment with using (command) instead of (sendcommand).
This seems to be more suitable in this case.
Meaning:
(command "extrim" ent cpt)Also, in my testing, I temporarily set OSMODE=0.
"gcen" worked better with this setting.0 -
In case any one read this post and was interested, there is just something a bit different with Bricscad Extrim, compared to Acad, tried all sorts of combinations.
The final working solution was to write a script with every pline entity handle and centre pt.
Extrim (handent "ABCDE" "1213,456"
Happy to provide code just ask.
0

