XREF Attachment Type System Variable

When attaching XREFs to your drawings, the choice to insert them as an “Overlay” or as an “Attachment” may not be so clear and might be confusing.

Overlay – only the XREF that is selected is referenced in the current drawing.

Attachment – The Selected XREF is referenced and any XREFs that are associated with that drawing are also brought in to the current drawing.

XREFs that are brought in as “Attached” might bring unwanted objects or even create a circular reference. To avoid this, it is recommended  to bring XREFs into your drawings as an “Overlay.” This is great except that AutoCAD’s default is set to bring them in as “Attached.”

To change this:

Change the system variable XREFTYPE to <1>

Posted in TIPS, XREFs | 2 Comments

AutoCAD 2013: Offset Preview

Simliar to the preview functionality that was added last year with AutoCAD 2012 found in the Fillet command and BLEND tool, The OFFSET/CHAMFER command now has a preview in AutoCAD 2013.

There isn’t any other new functionality in the command – only the preview that appears prior to placing the object.

 

Shown below: the use of the multiple option when placing multiple offsets in one direction

Shown below: Multiple offsets in 2 directions

 

Posted in AutoCAD 2013, BASICS, Modifying, New In 2013 | Leave a comment

AutoLISP: Globally Change XREF Attachment Type

If you need to Changeall of the way in which XREF’s are attached this routine is for you. This routine will change all XREFs in a drawing to either “Overlay” or “Attached.”

Here’s How:

  • X2A <enter> = All XREFs to “Attached”

OR

  • X2O <enter> = All XREFs to “Overlay”

That’s it!!!!

~enjoy


;*****************************************************************************************************************
;Xref to Attach/Overlay										**
;Written by: Chris Wade										**
; 			  									**
;Version 2.1a  											**
;12/07/2011	  										**
;		 			  							**
;- Adjusted code to temporarily disable all reactors to prevent interference with LISP routine. **
; 			  									**
;Version 2.1	  										**
;12/05/2011	  										**
;	 			  								**
;- Changes that attachment type for all XRefs. 							**
;- X2A - Changes all xrefs to attached method.							**
;- X2O - Changes all xrefs to overlay method.							**
;	 			  								**
;- Known Limitations:		  								**
;- Viewport specific layer overrides may not be restored.					**
;	  	  	  									**
;*****************************************************************************************************************
(defun C:x2a ()
  (xmethodflip "a")
)
(defun C:x2o ()
  (xmethodflip "o")
)
(defun xmethodflip (mode	/	    *ACAD_DOC*	*PaperSpace*
		    *ModelSpace*	    *Active*	*ActiveID*
		    allReactors	cLayout	    BlockDef	xObj2
		    SS2		LS	    Temp	Clip
		    ClipLength	ClipCount   ClipTemp	Clip1
		    Clip2	xIsClipped  XNameList	BlockCollection
		    xInsPt	xLayer	    xScaleX	xScaleY
		    xScaleZ	xRotation   xPath	Obj2
		    xObj	xObjName    xLayout	xOwnerID
		   )			; Mode - O = Overlay / A = Attach
  (vl-load-com)
  (setvar "cmdecho" 0)
  (setq	*ACAD_DOC*   (vla-get-ActiveDocument (vlax-get-acad-object))
	*PaperSpace* (vla-get-paperspace *ACAD_DOC*)
	*ModelSpace* (vla-get-modelspace *ACAD_DOC*)
  )
  (cond
    ((or (= (getvar "tilemode") 1) (/= (getvar "cvport") 1))
     (setq xLayout *ModelSpace*)
    )
    ((and (= (getvar "tilemode") 0) (= (getvar "cvport") 1))
     (setq xLayout *PaperSpace*)
    )
  )
					;Supporting Functions
  (defun x2a_NotNested (name / SS)
    (setq
      ss (ssget "_X" (list (cons 2 name) (cons 410 (getvar "ctab"))))
    )
    SS
  )
  (defun x2a_r2d (rad /)
    (/ (* rad 180) pi)
  )
  (defun x2a_GetXclip (ename / __XClipBoundary elist xlist _xang _xnor)
; Code from Lee Mac @ http://www.theswamp.org/index.php?topic=39201.msg444239#msg444239
;; Matrix x Vector - Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n

    (defun mxv (m v)
      (mapcar '(lambda (r) (apply '+ (mapcar '* r v))) m)
    )

    ;; Matrix x Matrix - Vladimir Nesterovsky
    ;; Args: m,n - nxn matrices

    (defun mxm (m n)
      ((lambda (a) (mapcar '(lambda (r) (mxv a r)) m)) (trp n))
    )

    ;; Matrix Transpose - Doug Wilson
    ;; Args: m - nxn matrix

    (defun trp (m) (apply 'mapcar (cons 'list m)))

    (defun __XClipBoundary (ename / xdict)
      (if
	(setq xdict (cdr (assoc 360 (entget ename))))
	 (__XClipBoundary xdict)
	 (if
	   (and
	     (eq "SPATIAL_FILTER"
		 (cdr (assoc 0 (setq ename (entget ename))))
	     )
	     (eq 1 (cdr (assoc 71 ename)))
	   )
	    (
	     (lambda (massoc) (massoc 10 ename))
	      (lambda (key elist / item)
		(if (setq item (assoc key elist))
		  (cons (cdr item) (massoc key (cdr (member item elist))))
		)
	      )
	    )
	 )
      )
    )

    (defun __dxf (key lst) (cdr (assoc key lst)))

    (setq elist	(entget ename)
	  _xang	(__dxf 50 elist)
	  _xnor	(__dxf 210 elist)
    )
    (if	(setq xlist (__XClipBoundary ename))
      (
       (lambda (matrix)
	 (
	  (lambda (vector)
	    (mapcar
	      (function
		(lambda	(point)
		  (mapcar '+ (mxv matrix point) vector)
		)
	      )
	      xlist
	    )
	  )
	   (mapcar '-
		   (trans (__dxf 10 elist) _xnor 0)
		   (mxv	matrix
			(__dxf 10 (tblsearch "BLOCK" (__dxf 2 elist)))
		   )
	   )
	 )
       )
	(mxm
	  (mapcar
	    (function
	      (lambda (v) (trans v 0 _xnor t))
	    )
	    '(
	      (1.0 0.0 0.0)
	      (0.0 1.0 0.0)
	      (0.0 0.0 1.0)
	     )
	  )
	  (mxm
	    (list
	      (list (cos _xang) (sin (- _xang)) 0.0)
	      (list (sin _xang) (cos _xang) 0.0)
	      (list 0.0 0.0 1.0)
	    )
	    (list
	      (list (__dxf 41 elist) 0.0 0.0)
	      (list 0.0 (__dxf 42 elist) 0.0)
	      (list 0.0 0.0 (__dxf 43 elist))
	    )
	  )
	)
      )
    )
  )
  ;;  by CAB 10/05/2007
  ;;  Expects pts to be a list of 2D or 3D points
  ;;  Returns new pline object
  (defun x2a_makePline (spc pts)
    ;;  flatten the point list to 2d
    (if	(= (length (car pts)) 2)	; 2d point list
      (setq pts (apply 'append pts))
      (setq
	pts (apply 'append
		   (mapcar '(lambda (x) (list (car x) (cadr x))) pts)
	    )
      )
    )
    (setq
      pts (vlax-make-variant
	    (vlax-safearray-fill
	      (vlax-make-safearray
		vlax-vbdouble
		(cons 0 (1- (length pts)))
	      )
	      pts
	    )
	  )
    )
    (vla-addlightweightpolyline spc pts)
  )
;Code to determine if layerstate is present provided by AlanJT
  (defun x2a_isLayerStatePresent (doc layerstate / state)
    (if	(not
	  (vl-catch-all-error-p
	    (vl-catch-all-apply
	      '(lambda (/)
		 (setq state
			(vla-item (vla-item (vla-GetExtensionDictionary
					      (vla-get-layers doc)
					    )
					    "ACAD_LAYERSTATES"
				  )
				  layerstate
			)
		 )
	       )
	    )
	  )
	)
      state
    )
  )
;End of Supporting Functions
  (vla-StartUndoMark *ACAD_DOC*)
  (setq allReactors (apply 'append (mapcar 'cdr (vlr-reactors))))
  (if allReactors
    (mapcar 'vlr-remove allReactors)
  )
  ; temporarily disable all reactors - Code by roy_043 @ http://www.theswamp.org/index.php?topic=34597.msg408535#msg408535
  (setq cLayout (vla-get-activelayout *ACAD_DOC*))
  (vlax-for L (vla-get-layouts *ACAD_DOC*)
    (vla-put-activelayout *ACAD_DOC* L)
    (setq SS (ssget "_X"
		    (list '(0 . "INSERT") (cons 410 (getvar "ctab")))
	     )
    )
    (cond
      (SS
       (setq LS	1
	     BlockCollection
	      (vla-get-blocks *ACAD_DOC*)
       )
       (while (x2a_isLayerStatePresent
		*ACAD_DOC*
		(strcat "X2A-" (rtos LS 2 0))
	      )
	 (setq LS (+ LS 1))
       )
       (vl-cmdf	"._-layer"
		"_a"
		"_save"
		(strcat "X2A-" (rtos LS 2 0))
		""
		""
		""
       )
       ((lambda	(i / Ent)
	  (while (setq Ent (ssname SS (setq i (1+ i))))
	    (setq xObj2 (vlax-ename->vla-object Ent))
	    (cond
	      (xObj2
	       (setq BlockDef (vla-item	BlockCollection
					(vla-get-name xObj2)
			      )
	       )
	       (cond
		 ((= (vla-get-isxref BlockDef) :vlax-true)
		  (setq	xRname (vla-get-name xObj2)
			xPath  (vla-get-path BlockDef)
			SS2    (x2a_NotNested xRname)
		  )
		  ((Lambda (I2 / Ent2)
		     (While
		       (Setq Ent2 (Ssname Ss2 (Setq I2 (1+ I2))))
			(Setq Xobj	 (Vlax-ename->vla-object Ent2)
			      Xinspt	 (Cons (Vlax-safearray->list
						 (Variant-value
						   (Vla-get-insertionpoint Xobj)
						 )
					       )
					       Xinspt
					 )
			      Xownerid	 (Cons (Vla-get-ownerid Xobj)
					       Xownerid
					 )
			      Xscalex	 (Cons (Vla-get-xscalefactor Xobj)
					       Xscalex
					 )
			      Xscaley	 (Cons (Vla-get-yscalefactor Xobj)
					       Xscaley
					 )
			      Xscalez	 (Cons (Vla-get-zscalefactor Xobj)
					       Xscalez
					 )
			      Xrotation	 (Cons (Vla-get-rotation Xobj)
					       Xrotation
					 )
			      Xlayer	 (Cons (Vla-get-layer Xobj) Xlayer)
			      Xisclipped (Cons
					   (X2a_getxclip
					     (Vlax-vla-object->ename Xobj)
					   )
					   Xisclipped
					 )
			)
		     )
		   )
		    -1
		  )
		  (vla-detach BlockDef)
		  ((Lambda (Ct2 / Ent2)
		     (While
		       (Setq Ent2 (Ssname Ss2 (Setq Ct2 (1+ Ct2))))
			(cond
			  ((or (< (nth Ct2 xScaleX) 0)
			       (< (nth Ct2 xScaleY) 0)
			       (< (nth Ct2 xScaleZ) 0)
			   )		; This is put here for xRefs that have been mirrored.
			   (vl-cmdf "._-xref"
				    (strcat "_" mode)
				    xPath
				    (nth Ct2 xInsPt)
				    (nth Ct2 xScaleX)
				    (nth Ct2 xScaleY)
				    (x2a_r2d (nth Ct2 xRotation))
			   )
			   (setq
			     Obj2 (vlax-ename->vla-object (entlast))
			   )
			  )
			  (T
			   (cond
			     ((= (strcase mode) "O")
			      (setq Obj2
				     (vla-attachexternalreference
				       xLayout
				       xPath
				       (vl-filename-base xPath)
				       (vlax-3D-point (nth Ct2 xInsPt))
				       (nth Ct2 xScaleX)
				       (nth Ct2 xScaleY)
				       (nth Ct2 xScaleZ)
				       (nth Ct2 xRotation)
				       :vlax-true
				     )
			      )
			     )
			     ((= (strcase mode) "A")
			      (setq Obj2
				     (vla-attachexternalreference
				       xLayout
				       xPath
				       (vl-filename-base xPath)
				       (vlax-3D-point (nth Ct2 xInsPt))
				       (nth Ct2 xScaleX)
				       (nth Ct2 xScaleY)
				       (nth Ct2 xScaleZ)
				       (nth Ct2 xRotation)
				       :vlax-false
				     )
			      )
			     )
			   )
			  )
			)
			(vla-put-layer Obj2 (nth Ct2 xLayer))
			(cond
			  ((nth Ct2 xIsClipped)
			   (setq Clip	    (nth Ct2 xIsClipped)
				 ClipLength (length Clip)
				 ClipCount  0
			   )
			   (cond
			     ((= ClipLength 2)
			      (setq Clip1 (nth 0 Clip)
				    Clip2 (nth 1 Clip)
				    Clip  (list	Clip1
						(list (car Clip2)
						      (cadr Clip1)
						      (caddr Clip1)
						)
						Clip2
						(list (car Clip1)
						      (cadr Clip2)
						      (caddr Clip2)
						)
					  )
			      )
			     )
			   )
			   (setq Clip (x2a_MakePline xLayout Clip))
			   (cond
			     ((/= (vla-get-closed Clip) T)
			      (vla-put-closed Clip T)
			     )
			   )
			   (vl-cmdf "._xclip"
				    (vlax-vla-object->ename Obj2)
				    ""
				    "_N"
				    "_S"
				    (entlast)
			   )
			   (vla-delete Clip)
			  )
			)
		     )
		   )
		    -1
		  )
		 )
	       )
	      )
	    )
	  )
	)
	 -1
       )
       (command	"._-layer"
		"a"
		"restore"
		(strcat "X2A-" (rtos LS 2 0))
		""
		""
       )
       (command	"._-layer"
		"a"
		"delete"
		(strcat "X2A-" (rtos LS 2 0))
		""
		""
       )
      )
    )
  )
  (vla-put-activelayout *ACAD_DOC* cLayout)
  (if allReactors
    (mapcar 'vlr-add allReactors)
  )					; Restores Reactors
  (vla-EndUndoMark *ACAD_DOC*)
  (princ)
)
Posted in AutoLISP, AutoLISP XREFs, AutoLISP: Modify, XREFs | 2 Comments

AutoCAD 2013: Paper Space Viewports

With the new addition of the panel in the “View” tab that only pertains to Model Space viewports [shown here], you might want to know where to set your Paper Space viewports.

In AutoCAD 2013, you now have a new tab on the ribbon called “Layout” (Shown below).

This tab of the ribbon displays differently depending on whether Model Space or Paper Space is active.

Shown below: New layout tab with Model Space active

Shown below: New Layout tab with Paper Space active

All of the old functions (prior to 2013) are available in this new tab.

Previously found by right-clicking a layout tab, creating a layout tab from scratch or from a template is found in the ribbon.

Creating new Viewports is found in the “Layout Viewports” panel

Dont forget that the command alias MV <enter> lets you quickly pick 2 points and easily create a viewport.

I will show more of the features of the new “Layout” tab of the ribbon in future posts. Autodesk has made some great improvements in regards to model documentation which is found in this tab.

Posted in AutoCAD 2013, BASICS, Layout, New In 2013, TIPS, Viewports | 47 Comments

AutoLISP: External Contours of Objects

This routine is helpful if you have overlapping objects that form a closed area and you would like to combine them into one overall closed object. This is like the UNION command but for 2D closed areas.

Here’s how:

  • ECO <enter> External Contour of Objects
  • Select overlapping objects <enter>


;| ! *******************************************************************
;; !                  lib:IsPtInView
;; ! *******************************************************************
;; ! ????????? ????????? ?? ????? ? ??????? ??????
;; ! Auguments: 'pt'  - ????? ??? ??????? ? ???!!!
;; ! Return   : T ??? nil ???? 'pt' ? ??????? ?????? ??? ???
;; ! *******************************************************************|;
(defun lib:IsPtInView (pt / VCTR Y_Len SSZ X_Pix Y_Pix X_Len Lc Uc)
(setq pt (trans pt 0 1))  
(setq VCTR (getvar "VIEWCTR") Y_Len (getvar "VIEWSIZE")
   SSZ (getvar "SCREENSIZE")
   X_Pix (car SSZ) Y_Pix (cadr SSZ)
   X_Len (* (/ X_Pix Y_Pix) Y_Len)
   Lc (polar VCTR (dtr 180.0) (* 0.5 X_Len))
   Uc (polar Lc 0.0 X_Len)
   Lc (polar Lc (dtr 270.0) (* 0.5 Y_Len))
   Uc (polar Uc (dtr 90.0) (* 0.5 Y_Len)))
(if (and (> (car pt) (car Lc))(< (car pt) (car Uc))
  (> (cadr pt) (cadr Lc))(< (cadr pt) (cadr Uc)))
 T nil))
(defun DTR (a)(* pi (/ a 180.0)))
;| ! ***************************************************************************
;; !           lib:pt_extents
;; ! ***************************************************************************
;; ! Function : ?????????? ??????? MIN, MAX X,Y,Z ?????? ?????
;; ! Argument : 'vlist' - ?????? ?????
;; ! Returns  : ?????? ????? (??????? ?????????)
;; ! ***************************************************************************|;
(defun  lib:pt_extents (vlist / tmp)
(setq tmp (mapcar '(lambda (x) (vl-remove-if 'null x))
 (mapcar '(lambda (what) (mapcar '(lambda (x) (nth what x)) vlist))
 '(0 1 2))));_setq
  
  (list (mapcar '(lambda(x)(apply 'min x)) tmp)(mapcar '(lambda(x)(apply 'max x)) tmp)));_defun
;http://www.theswamp.org/index.php?topic=15123.0
;;;(defun GetBoundingBox-3d (pt_lst)
;;;  (list (apply 'mapcar (cons 'min pt_lst))
;;; (apply 'mapcar (cons 'max pt_lst))
;;;  )
;;;)
; ! ***********************************************************
;; !                             lib:Zoom2Lst
;; ! **********************************************************
;; ! Function : Zoom ?????? ?????? ?????
;; ! Arguments: 'vlist' - ?????? ????? ? ???!!!!
;; ! ????????? ?????, ????? ??? ????? ???? ?????
;; ! Returns  : t - ???? ???????????? nil - ???
;; ! **********************************************************
(defun lib:Zoom2Lst( vlist / bl tr Lst OS)
(setq Lst (lib:pt_extents vlist)
 bl (car Lst) tr (cadr Lst))
(if (not (and (lib:IsPtInView bl) (lib:IsPtInView tr)))
(progn  (setq OS (getvar "OSMODE"))(setvar "OSMODE" 0)
 (command "_.Zoom" "_Window" (trans bl 0 1)(trans tr 0 1)
  "_.Zoom" "0.95x")
 (setvar "OSMODE" OS)
  T) NIL))
;External contour of objects
(defun C:ECO ( / *error* blk obj MinPt MaxPt hiden pt pl unnamed_block isRus
       tmp_blk adoc blks lays lay oname sel csp loc sc ec ret DS osm iNSpT)
(defun *error* (msg)(princ msg)(mapcar '(lambda (x) (vla-put-Visible x :vlax-true)) hiden)
(vla-endundomark adoc)(if (and tmp_blk (not (vlax-erased-p tmp_blk))(vlax-write-enabled-p tmp_blk) )
(vla-Erase tmp_blk))(if osm (setvar "OSMODE" osm))(foreach x loc (vla-put-lock x :vlax-true)))
(vl-load-com)(setvar "CMDECHO" 0)(setq osm (getvar "OSMODE"))
 (if (zerop (getvar "WORLDUCS"))(progn(vl-cmdf "_.UCS" "")(vl-cmdf "_.Plan" "")))
(setq isRus (= (getvar "SysCodePage") "ANSI_1251"))
(setq adoc (vla-get-ActiveDocument (vlax-get-acad-object))
        blks (vla-get-blocks adoc) lays (vla-get-layers adoc))
  (vla-startundomark adoc)(if isRus (princ "\n???????? ??????? ??? ?????????? ???????")(princ "\nSelect objects for making a contour"))
  (vlax-for lay lays
      (if (= (vla-get-lock lay) :vlax-true)
          (progn (vla-put-lock lay :vlax-false) (setq loc (cons lay loc))))
      )
 (if (setq sel (ssget))(progn
    (setq sel (ssnamex sel))
;;;    (setq iNSpT(apply 'mapcar (cons 'min 
;;;     (mapcar 'cadr (apply 'append (mapcar '(lambda(x)(vl-remove-if-not 'listp x)) sel))))))
    (setq iNSpT '(0 0 0))
    (setq sel (mapcar 'vlax-ename->vla-object(vl-remove-if 'listp (mapcar 'cadr sel))))
    (setq csp (vla-objectidtoobject adoc (vla-get-ownerid (car sel))))
   ; (setq unnamed_block (vla-add (vla-get-blocks adoc)(vlax-3d-point '(0. 0. 0.)) "*U"))
    (setq unnamed_block (vla-add (vla-get-blocks adoc)(vlax-3d-point inspt) "*U"))
    (foreach x sel
      (setq oname (strcase (vla-get-objectname x)))
      (cond ((member oname '("ACDBVIEWPORT" "ACDBATTRIBUTEDEFINITION" "ACDBMTEXT" "ACDBTEXT")) nil)
     ((= oname "ACDBBLOCKREFERENCE")
      (vla-InsertBlock unnamed_block
        (vla-get-insertionpoint x)(vla-get-name x)
        (vla-get-xscalefactor x)(vla-get-yscalefactor x)
        (vla-get-zscalefactor x)(vla-get-rotation x))
      (setq blk (cons x blk)))
     (t (setq obj (cons x obj)))));_foreach
        (setq lay  (vla-item lays (getvar "CLAYER")))
        (if (= (vla-get-lock lay) :vlax-true)(progn (vla-put-lock lay :vlax-false) (setq loc (cons lay loc))))
     (if obj (progn (vla-copyobjects (vla-get-activedocument (vlax-get-acad-object))
              (vlax-make-variant (vlax-safearray-fill
                  (vlax-make-safearray vlax-vbobject (cons 0 (1- (length obj))))
                  obj)) unnamed_block)))
    (setq obj (append obj blk))
    (if obj (progn
          ;(setq tmp_blk (vla-insertblock csp (vlax-3d-point '(0. 0. 0.))(vla-get-name unnamed_block) 1.0 1.0 1.0 0.0))
              (setq tmp_blk (vla-insertblock csp (vlax-3d-point inspt)(vla-get-name unnamed_block) 1.0 1.0 1.0 0.0))
          (vla-GetBoundingBox tmp_blk 'MinPt 'MaxPt)  ;_??????? ?????
               (setq MinPt (vlax-safearray->list MinPt) MaxPt (vlax-safearray->list MaxPt)
       DS (max (distance MinPt (list (car MinPt)(cadr MaxPt)))
        (distance MinPt (list (car MaxPt)(cadr MinPt))))
              DS (* 0.2 DS) ;1/5
       DS (max DS 10) MinPt (mapcar '- MinPt (list DS DS))
                     MaxPt (mapcar '+ MaxPt (list DS DS)))
(lib:Zoom2Lst (list MinPt MaxPt))(setq sset (ssget "_C" MinPt MaxPt))
(if sset (progn (setvar "OSMODE" 0)
      (setq hiden (mapcar 'vlax-ename->vla-object(vl-remove-if 'listp (mapcar 'cadr (ssnamex sset))))
     hiden (vl-remove tmp_blk hiden))
      (mapcar '(lambda(x)(vla-put-Visible x :vlax-false)) hiden)
      (setq pt (mapcar '+ MinPt (list (* 0.5 DS)(* 0.5 DS))))
      (vl-cmdf "_.RECTANG" (trans MinPt 0 1)(trans MaxPt 0 1))
      (setq pl (vlax-ename->vla-object(entlast)))
      (setq sc (1-(vla-get-count csp)))
      (if (VL-CATCH-ALL-ERROR-P (VL-CATCH-ALL-APPLY '(lambda ()
         (vl-cmdf "_-BOUNDARY" (trans pt 0 1) "")
              (while (> (getvar "CMDACTIVE") 0)(command "")))))
      (if isRus (princ "\n?? ??????? ????????? ??????")(princ "\nIt was not possible to construct a contour")))
      (setq ec (vla-get-count csp))
        (while (< sc ec)(setq ret (append ret (list (vla-item csp sc))) sc(1+ sc)))
      (setq ret (vl-remove pl ret))
      (mapcar '(lambda (x)(vla-Erase x)(vlax-release-object x))(list pl tmp_blk))(setq pl nil tmp_blk nil)
      (setq ret (mapcar '(lambda ( x / mipt)(vla-GetBoundingBox x 'MiPt nil)  ;_??????? ?????
                 (setq MiPt (vlax-safearray->list MiPt))(list MiPt x)) ret))
      (setq ret (vl-sort ret '(lambda (e1 e2)(< (distance MinPt (car e1))(distance MinPt (car e2))))))
      (setq pl (nth 1 ret) ret (vl-remove pl ret)) (mapcar 'vla-erase (mapcar 'cadr ret))
      (mapcar '(lambda(x)(vla-put-Visible x :vlax-true)) hiden)
      (foreach x loc (vla-put-lock x :vlax-true))
      (if pl (progn (initget  "Yes No")
      (if (= (getkword (if isRus "\n??????? ???????? [Yes/No] <No> : " "\nDelete objects? [Yes/No] <No> : ")) "Yes")
         (mapcar '(lambda (x) (if (vlax-write-enabled-p x)(vla-Erase x))) obj)))
 (if isRus (princ "\n?? ??????? ????????? ??????")(princ "\nIt was not possible to construct a contour")))))))
     (VL-CATCH-ALL-APPLY '(lambda ()(mapcar 'vlax-release-object
    (list unnamed_block tmp_blk csp blks lays))))));_if not
  (foreach x loc (vla-put-lock x :vlax-true))(setvar "OSMODE" osm)
  (vla-endundomark adoc)(vlax-release-object adoc)(princ))
Posted in AutoLISP, AutoLISP: Creating, AutoLISP: Modify, AutoLISP: Polylines | 3 Comments

AutoCAD 2013: Viewport Configuration Preview

This is a great improvement in AutoCAD 2013. Located in the new panel called “Model Viewports” on the View tab of the ribbon is the normal dropdown list but the improvement is that now you have a preview of how the viewports will be arranged.

Link to original post https://autocadtips.wordpress.com

The New panel called : “Model Viewports” is great because it makes it clear that the viewport tools located in this panel apply to model space.

Posted in AutoCAD 2013, BASICS, Customization, New In 2013, Settling In | 6 Comments

AutoCAD 2013: Add a Strikethrough to Text

You can now easily add a strikethrough to text objects such as MTEXT, MLeaders, Dimensions and text that is within Tables. Sorry, this doesn’t work for DTEXT (single line text). If you would like an automated way to add a strikethough for DTEXT visit Lee-mac’s site [found here].

To add a Strikethrough:

  • Double click the text object to open the text editor.
  • Select (highlight) the text that will have the strikethrough applied to
  • Click the new Strikethrough button that is found on the “Formatting” panel of the “Text Editor” contextual tab.

Posted in AutoCAD 2013, Modifying, Text, TIPS | Leave a comment

AutoCAD 2013 The new Command Line

The command line is perhaps the most notable change in 2013 and I love it. It takes up less room on the screen and yet performs the same for those who don’t want change and yet performs very differently.

The rumors that you here about Autodesk planning to get rid of the command line are simply not true as demonstrated by the development of this new command line. If they were planning on getting rid of it, they certainly wouldn’t spend time on developing a new command line…

Below is a screen shot of the overall AutoCAD 2013 screen as it has been opened for the first time on my computer:

Here are some of the command line’s new features:

Command Line looks and acts like a toolbar:

Click on the command prompt icon to access recently used commands

As Shown below, when options of a command are available, these options are now made more obvious by the making the options colored blue.

If that isn’t cool enough, you’ll love this – The options in the command line are selectable:

There are now 2 ways of viewing the history of command window

1) is to bring up the command history that that will automatically collapse after a few moments by clicking the arrow that is located all the way to the right on the command line:

2) To bring up the actual command window (text window) is to use CTRL + F2. So no longer does the funtion key F2 bring up the command line’s text window:

Below are some of the options to customize the new command line. To get to this menu, you click on the wrench icon in the command line.

1) This is a personal preference but I think that most people will do this as well. By default, the AutoComplete > Auto Append function is turned on. This will fill in a command as you are typing it in. This is annoying because if you are entering a command alias that is only one or two letters, the Auto Append feature will fill in the a command that also starts with those one or two letters.

2) Customize the number of lines in the command line history. This number represents the lines that pop up and fade away above the command line.

3) Customize the transparency of the command line

The command line can be docked into its old position by simply dragging it to the bottom of the screen.

This tip applies to tool palettes and toolbars as well – If you hold the CTRL button while dragging the command line, it will prevent them from snapping or auto-docking to certain areas in the drawing area. This will allow to place the command line precisely where you want it.

You can specify the font of the command line.

Options dialog box [OP <enter>] > Display tab > Fonts button:

Posted in AutoCAD 2013, BASICS, Customization, New In 2013, Settling In | 80 Comments

AutoCAD 2013 Draw Order: Leaders

Now available in AutoCAD 2013 is a new draw order tool. This tool will bring all leader objects to the front of the draw order.

The command for this tool is an option with the command TEXTTOFRONT <enter>

Or The draw order tool can be found on the Home tab > Modify panel Draw Order flyout and select the “Bring Leaders to Front” tool.

Link to original post at https://autocadtips.wordpress.com

Below is the command line version of this tool by using the command TEXTTOFRONT <enter>

Note: that you also have the “All” option which will bring all Text, Dimensions and Leaders to the front of the draw order.

Posted in AutoCAD 2013, Leaders, Manage, Modifying, New In 2013, Text | 3 Comments

AutoCAD 2013 Annotation Monitor

The new “Annotation Monitor” is shown as “AM” in the drafting setings toggles in the status bar. I suggest that users turn these settings to text instead of the icons. The reason for this is because what usually what happens is that if the icons are displayed, the user will hover the cursor over the icon until the text appears to show what the icon is. Well, if you simply change this to text in the first place, you can save yourself that step…

To do this:

  • Right click over any of the drafting settings buttons
  • Uncheck “Use Icons”

The Annotation Monitor simply alerts you when you have drawing views that have associative annotations that have been altered or have lost their link to the object(s) in model space.

Posted in AutoCAD 2013, Customization, Layout, New In 2013, Paper Space | Leave a comment