Alter .lsp to work with icad?

#1
Can anyone fine tune this to work in IntelliCAD? It works great in Autocad. It's for imprinting multiple entities onto 3d solid faces. Thanks! - Quan?

Code: Select all

(defun c:mulimp (/ a ans b itm num ss ss1)
  (if (and (princ "\nSelect a 3D solid or surface: ")
	   (setq ss (ssget "_+.:E:S:L" '((0 . "3DSOLID,*SURFACE"))))
	   (princ "\nSelect objects to imprint: ")
	   (setq ss1 (ssget "_:L" '((0 . "ARC,CIRCLE,LINE,*POLYLINE,ELLIPSE,SPLINE,REGION,3DSOLID"))))
	   (progn
	     (initget "Y N")
	     (setq ans (cond ((getkword "\nDelete entities? [N Y] <N>: "))
			     ("N")
		       )
	     )
	   )
      )
    (progn
      (setq itm	0
	    num	(sslength ss1)
      )
      (command "_.imprint" (setq a (ssname ss 0)))
      (while (< itm num)
	(if (not (eq a (setq b (ssname ss1 itm))))
	  (command b (strcat "_" ans))
	)
	(setq itm (1+ itm))
      )
      (command "")
    )
  )
  (princ)
)
; with Y or N choice
;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/imprint-multiple-objects/td-p/5496030
33+ years using Autocad, wanting to fully learn iCad and share my knowledge of applicable crossover info from Acad.
-=(RLH)=-

Re: Alter .lsp to work with icad?

#2
Hi Hamm,

In the IntelliCAD, we can use the command "SolidEdit" to imprint an object to a solid object.
refer this routine:

Code: Select all

(defun c:imp (/ ans ent sol)
  (if (and (setq sol (car (entsel "\nSelect a 3D solid or surface: ")))
	   (princ "\nSelect objects to imprint: ")
	   (setq ent (car (entsel "\nSelect a object to imprint: ")))
	   (progn
	     (initget "Y N")
	     (setq ans (cond ((getkword "\nDelete entities? [N Y] <N>: "))
			     ("N")
		       )
	     )
	   )
      )
    (progn      
      (command "_.solidedit" "body" "imprint" sol ent ans "exit" "exit")      
    )
  )
  (princ)
)

Re: Alter .lsp to work with icad?

#3
Quan,
I think that the thing that is missing is a while loop, what I need to do is select multiple entities to imprint at one time like my original code.
Do you know how to make the original code work in IntelliCAD?
Thanks much,
Ramon
33+ years using Autocad, wanting to fully learn iCad and share my knowledge of applicable crossover info from Acad.
-=(RLH)=-

Re: Alter .lsp to work with icad?

#4
Try this:

Code: Select all

(defun c:imps (/ ans ent itm sol ss)
	(if (and (setq sol (car (entsel "\nSelect a 3D solid or surface: ")))
			(princ "\nSelect objects to imprint: ")
			(setq ss (ssget  '((0 . "ARC,CIRCLE,LINE,*POLYLINE,ELLIPSE,SPLINE,REGION,3DSOLID"))))
			(progn
				(initget "Y N")
				(setq ans (cond ((getkword "\nDelete entities? [N Y] <N>: ")) ("N") ) ) )
		)
		(progn
			(setq itm	0)
			(while (< itm (sslength ss))
				(if (not (eq sol (setq ent (ssname ss itm))))
					(command "_.solidedit" "body" "imprint" sol ent ans "exit" "exit")	)
				(setq itm (1+ itm))
			)
		)
    )
	(princ))
cron