Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

leeminardi
en respuesta a: jthompsonGJ3BH

Try the following lisp program.  It assumes that you select a block and that its base point is on the XY world plane (z = 0).  It also assumes that after reorienting the block the block's x axis is parallel to the world x axis.

(defun c:test (/ osm blkdata Tmatrix BasePt ptBlockX ptBlockXY ptxaxis
	       ptxyplane)
; aligns block to the xy plane
; lrm 1/10/2024  
  (setq osm (getvar "osmode"))
  (setvar "osmode" 0)
  (setq	blkdata	  (nentsel)
	Tmatrix	  (nth 2 blkdata)
	BasePt	  (nth 3 Tmatrix)
	ptBlockX  (mapcar '+ BasePt (nth 0 Tmatrix))
	ptBlockXY (mapcar '+ BasePt (nth 0 Tmatrix) (nth 1 Tmatrix))
	ptxaxis	  (mapcar '+ BasePt '(100 0 0))
	ptxyplane (mapcar '+ Basept '(100 100 0))
  )
  (command "_align"   "last"	 ""	    BasePt     BasePt
	   ptBlockX   ptxaxis	 ptBlockXY  ptxyplane  
	  )
  (setvar "osmode" osm)
  (princ)
)

 

 

 

 

 

 

lee.minardi