imprint multiple objects

imprint multiple objects

Anonymous
Not applicable
2,366 Views
8 Replies
Message 1 of 9

imprint multiple objects

Anonymous
Not applicable

I need a lisp that imprint multiple objects at the same time (by window selection, lines and polylines) into 3d solid

 

 

Accepted solutions (1)
2,367 Views
8 Replies
Replies (8)
Message 2 of 9

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

I need a lisp that imprint multiple objects at the same time (by window selection, lines and polylines) into 3d solid

 

 


More information is needed, and an image or sample drawing would be better still.  What does it mean to "imprint" a Line "into" a 3D Solid?  If you want to carve something out of the surface of the Solid, you will need to base it on something more than a Line, which [being only one-dimensional] has no volume that can be Subtracted [or added, if you want something raised above the Solid surface], but a Polyline with width could be Extruded into something with volume that could be Subtracted from [or added to] the Solid.  Or do you only mean you want to put Lines and Polylines onto the surface of a Solid?  Does the solid have flat surfaces that Lines and Polylines could be drawn on?  Etc., etc.

Kent Cooper, AIA
0 Likes
Message 3 of 9

Anonymous
Not applicable

i want imprint muliple coplanaire 2d lines on a 3d solid to create additional edges on planar faces , because imprint commande imprint 2d geometrie one by one and ask me if i want to delete source  whenever

thanks

0 Likes
Message 4 of 9

hmsilva
Mentor
Mentor
Accepted solution

Hi majdov24,

a quick and dirty solution...
The 'demo' is not testing if a valid object (with intersection edges) is selected by the user, if an invalid object is selected, the code will throw an error...

Sorry, I have a deadline to meet, so at the moment, I don't have much free time.

 

(defun c:demo (/ a 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
       (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 "_Y");; change to N if you don't want to delete
	  )
	(setq itm (1+ itm))
	)
      (command "")
      )
    )
  (princ)
  )

 

 

Hope that helps
Henrique

EESignature

Message 5 of 9

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:
....  What does it mean to "imprint" a Line "into" a 3D Solid?  ....

[Never mind me -- Imprint is a command in newer versions, that I wasn't familiar with, and hand't run into since I don't often work in 3D.]

Kent Cooper, AIA
0 Likes
Message 6 of 9

rhgrafix
Enthusiast
Enthusiast

That's awesome! Thanks for writing that, I've been wanting this for years! I know it was a quick write from you and you have the skills to include the choice of keeping or deleting the imprinted entities, I don't. For now I will just make a copy of them and re-merge them. Hard to believe Autodesk doesn't include the choice for multiple Imprints after all these years, hmm.

Thanks again!

0 Likes
Message 7 of 9

hmsilva
Mentor
Mentor

Untested...

(defun c:demo (/ 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 the source object [Yes/No] <N>: "))
			     ("Y")
		       )
	     )
	   )
      )
    (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)
)

Hope this helps,
Henrique

EESignature

0 Likes
Message 8 of 9

rhgrafix
Enthusiast
Enthusiast

 That works perfectly! I did change one thing, the prompt asks: "Enter rotation angle" instead of: "Keep entities?"  I assume you pasted some code from a similar macro or something.

Thanks again!

R.L. Hamm

0 Likes
Message 9 of 9

rhgrafix
Enthusiast
Enthusiast

 Actually if someone could add the choice to this shorter code, it would be the ultimate macro:

https://www.cadtutor.net/forum/topic/48753-command-imprint-for-multiple-objects/?do=findComment&comm...

-=(R)=-

0 Likes