Quantcast
Channel: AutoCAD Tips
Viewing all 89 articles
Browse latest View live

Cant See .ctb files: CONVERTPSTYLES

$
0
0

When opening a drawing that is from someone else, they may have set the drawing to plot/print using a “Style” that has a file extension of “.stb” instead of a “.ctb”

What is a “.stb”?
The settings that define how a drawing looks when it is printed can be defined by either how it handles each color in the drawing (.ctb = Color Dependent Plot Style) or by wrapping up many of the various plot settings as a “Style” (.stb = Named Plot Style).

NO CTB 1

When you come across a drawing that has plot styles (,stb) and not your usual .ctb files simply use the command CONVERTPSTYLES <enter>

 

It will notify that it will no longer be looking for .ctb files

Click OK

NO CTB 2

 

Just to verify that it worked, look in the command line…

NO CTB 3

 

Now the drawing should be able to see your .ctb files when plotting.

NO CTB 4



OFFSET Polyline True Distance – OFFSETGAPTYPE

$
0
0

The OFFSET command creates parallel copies of an object away from the original object.

Here’s the scenario – You have an electrical drawing with limited space. You also have an oddly shaped electrical box that requires a 4 foot space between it and anything else around it.

Since the drawing is tight on room, you want to make sure that you adhere to the recommended space requirements but you also need to maximize efficiency.

Below is the oddly shaped electrical box. It is represented by a polyline
OFSS1

 

When you offset the polyline by 4 feet, it creates a parallel copy around the polyline (shown below)

OFSS2

But after further inspection, you notice that not all of the outer polyline is really 4 feet away from the electrical box.

(Below) The sections of the outer polyline that touch the green areas are 4 feet away, but the sections of the outer poyline that touch the red areas are greater than 4 feet.

This will result in wasted space.
OFSS3

How do you fix this?
Change the system variable OFFSETGAPTYPE to <1>

This will create rounded edges at the corners of the polyline, thus maintaining a true offset distance of 4 feet all the way around the electrical box.

OFSS5

 

Shown below is the result of the OFFSET using OFFSETGAPTYPE set to <1>

Please note – to only use this when needed! It is not recommended to keep this setting as a permanent setting. However, it is good to know about.

 

 

OFSS4

 

 


Continue A Table In A New Column With A Table Break

$
0
0

AutoCAD table objects are great in how they act similar to Microsoft Excel allowing you to add columns and rows and with the controls available, you can format the table in many ways to add style to the table.
Today’s tip is useful for tables that are long in length. If the table is long in length and you scale it to fit on a sheet in order to print, everything might be too small and run together, thus making your print unreadable.

Below is a simple example of an AutoCAD table (note: it isn’t a very long table…)

Table Break 1

 

To get the table to “break” and have a continuation:

  • Select the Table
  • Click the arrow grip at the bottom-middle of the table

Table Break 2

 

Click to re-position the arrow grip somewhere higher on the screen (within the table). You should see the table overflow into new columns to the right.

Table Break 3

 

The distance that you defined by re-positioning the arrow will be the new length for this table. So as new rows are added to the table, once the table reaches that defined length it will overflow once more into a third column.

Displaying The Labels In The Table Breaks:

Once these table breaks have been applied, you can add the descriptive top area of the table that is shown in the first rows of the table. This will help clarify what the second column is in the third table break for instance.

The first 2 rows of the table are called “Labels” and can be designated as a “Header” or “Title.” (These are defined in the Table Style manager). The important thing to know is that if both a “Title” and “Header” are defined, they are BOTH considered a label and will be repeated.

Table default content

 

To turn on the repeating labels:

  • Select the Table
  • Right-Click and select “Properties” to open the properties palette

Table Break 4'

 

  • In the properties palette, scroll down to the “Table Breaks” section
  • Change “Enabled” to “Yes”
  • Change “Repeat top labels” to “Yes”
  • The result should be a repeated “Label” in the Table Breaks

Table Break 5


Add Dimension Leader Line

$
0
0

Sometimes when placing dimensions in a drawing, they can get cluttered and it isn’t always clear what dimension text belongs to what dimension.

(pictured below – example dimension)

Add Leader Line 1

There is a feature that lets you attach a leader to the dimension text and the mid point of the dimension line thus pointing out what text is referring to what dimension.

Note: This method is should keep you from exploding dimensions. Please stop exploding dimensions!!!!

Here’s how:

  • Select the dimension that is to have the leader applied
  • Hover over the grip next to the dimension text
  • Select “Move with Leader”

Add Leader Line 2

The Leader will now follow the text as it is re-positioned away from the original text position.

Add Leader Line 3

If the leader is not needed, remove it by doing the following:

  • Select the dimension (similar to above)
  • Hover over the grip next to the dimension text
  • Select “Reset Text Position” – this will return the text to its original position. If you want move the text and get rid of the leader (without returning the text to the original position) select “Move Text Only.”

Add leader Line 4


Express Tool: Save All Opened Drawings

$
0
0

If you have multiple drawings opened in AutoCAD at the same time and would like to save all the drawings before stepping away from your computer… you can easily save all the currently open drawings with one command.

Note: If there happens to be an unnamed drawing opened (like drawing1), you will prompted to give that file a name.

Here’s how:

  • SAVEALL <enter>

That’s it.

This command is an Express Tool so AutoCAD LT users will not be able to use this command.

I think that this tool should be a part of AutoCAD and not an Express Tool.

Multiple Drawings Open 1

http://autocadtips.wordpress.com/?p=2022


AutoLISP: Print All Layout Tabs

$
0
0

Here is a simple routine that should help plot all of the layout tabs in a drawing.

Note: This routine will print all of the layouts with the same setups -so this is a limitation and shouldn’t be applied to drawings that have layout tabs with various sizes and or orientation (Landscape and Portrait).

Last tested and used with AutoCAD 2011.

~Greg


;; Prints All Layout Tabs and names the new PDFs with the name of the
;; drawing followed by the layout tab name.
;;
;; Adjust the paper size and .ctb file as needed.
;;
;; The PDFs will be placed in the folder where the drawing resides
;;
(defun c:PA ()
(foreach lay (layoutlist)
  (setvar 'CTab lay)
  (COMMAND 	"-PLOT"
		"Y"
		""
		"DWG To PDF.pc3"
		"ANSI full bleed A (8.50 x 11.00 Inches)"
		"Inches"
		"PORTRAIT"
		"N"
		"E"
		"f"
		"C"
		"Y"
		"monochrome.ctb"
		"Y"
		"N"
		"N"
		"N"
		""; Name of file
		"N"
		"y"      )
    )
)

Raster Design Quick Start

$
0
0

A very cool AutoCAD add-on called “Raster Design” lets you easily incorporate raster images like .jpegs and .tif files in you drawing. The cool part about this software is that it lets you edits the images even though they are pixelated images. You can even convert these pixels into AutoCAD entities for editing using you normal AutoCAD commands and then when you need to present the edits in a PDF, you can change the AutoCAD entities back into the pixelated form so that they match the rest of the image.

Shown below is the Raster Design 2014 ribbon tab:

Raster Design 2014 Ribbon Tab

Raster Design 2014 Ribbon Tab

Let’s get started:

  • INSERT AN IMAGE – Using the “Insert…” tool located on the far left of the ribbon, you can navigate to the image that is to be brought into the drawing. The command line version for this tool is IINSERT <enter>

Note: The terminology is a little confusing because usually images are brought into AutoCAD with the ATTACH command and blocks are usually the only things that are “inserted”…

IINSERT 1

 

  • Browse to the image.

Notice the options at the bottom of the screen. The 2 shown below are asking how you want to be prompted for various settings while inserting the image. If you want to take the default settings, click “Quick Insert”

INSERT IMAGE DIALOG 1

 

Once the image is in your drawing, you may need to re-position and scale the image to fit your needs. You can scale it by using the SCALE command or by dragging one of its corners to shrink or expand the image. To move the image, use the MOVE command.

IMAGE TO BITONAL – Many of the tools in Raster Design only work if the image is “bitonal” (black & white). Shades of grey or color images simply wont work well in Raster Design. To make the image “bitonal” click on the “Process Image” drop-down > then click “Change Color Depth” > then B <enter> in the command line to choose the “Bitonal” option.

IMAGE TO BITONAL

 

INVERT COLORS – Now that the image is in your drawing in black & white, you can change the colors so that you are working in a more familiar color scheme. You can easily invert the colors so that the lines are white and the background is your normal AutoCAD background.

Click on the “Cleanup” drop-down > then click “Invert”

IMAGE INVERT COLORS 1

 

(shown below: image colors inverted)

IMAGE INVERT COLORS 2

 

DESPECKLE – The little speckles that are present in the drawing from the image can be easily cleaned up and make your editing look that much cleaner (and easier to edit).

Click the “Cleanup” drop-down and then “Despeckle”

DESPCKLE 1

 

You are then asked to specify an area of the image that you wish to clean up. For this example I used I <enter> to clean the entire image.

Note: I did notice that on a few drawings, it erased some periods and commas in text that was in the image. So be aware that those may come across as “speckles” and may be cleaned.

DESPECKLE 2

 

You are then asked to specify the size of the speckle so that it will look for similar sized speckles and clean them up. You can do this by either picking within a speckle or by making a window selection. when you are done, the similar sized speckles that are found are highlighted in red and you are prompted to accept the selection set of what it is about to clean up.

MANUAL TOUCH UP – You may need to manually touch up the drawing. For this, the “Touchup” tool allows you to manually erase or draw sections of the image similar to Microsoft Paint allows you to draw with a few pixels at a time.

TOUCHUP1

  • Toggle the color of the “Touchup” tool to either black or white by clicking  ”Toggle drawing color”
  • The shape of the brush can be defined by the tools on the left side of the tool bar.
  • The angle of the brush is also defined on the 3rd tool from the left
  • The size of the brush can be changed by clicking the button shown below. This will let you define the size by either dragging a window or by entering a number.

TOUCHUP BRUSH SIZE 1

 

To exit the Touchup tool, use the buttons on the toolbar to CANCEL or OK to accept the edits.

Exit Touchup tool

 

CONVERT PIXELATED LINES TO VECTOR LINES – This allows you to make edits with your familiar AutoCAD commands. In the example below I only show how to use the tool that recognizes lines. There are other tools that recognize arcs, circles, polylines and rectangles.

On the “Vectorize & Recognize Text” panel, click the “Primitives” drop-down and then select “Line”

Vecortize Lines

 

  • Place the cursor within a line in the image. If the line is recognized, a dashed line will appear that has a little yellow arrow (glyph). To accept this, hit <enter> and the pixelated line will be turned into an AutoCAD line and the pixelated line will be erased.

RASTER LINE CLEANUP

 

When using this to recognize lines that should meet at their corners, it may not work as precisely as you’d like, but you can clean them up by using FILLET with a ZERO radius.

You may also need to use the Touchup tool to clean up left over pixels…

Raster Line Cleanup 2

 

Once the edits have been made, you will need to plot the drawing but the AutoCAD lines will look so different from the rest of the image. To change the AutoCAD lines back into “Raster” simply select the AutoCAD objects and then right click > select “Merge Vector To Raster Image”

Vector to Ratser 1

 

The AutoCAD objects will now match the Raster objects in the image

Vector to Raster 2

 

MANAGING THE IMAGE FILE (EMBED) – When you bring an image into a drawing, AutoCAD treats the image as a reference. that means that there will be 2 files needed in order for someone else to see the same thing that you see. Luckily, you can easily embed the image so that it is in the .dwg file so you only need to send someone the one file.

On the “Insert & Write” panel, click the “EMBED” tool and in one click, the image is now embedded in your drawing.

Embed the Picture into the drawing


AutoCAD Self Adjusting Text Frame Using Multileaders

$
0
0

If you have ever had to add a frame around your text and then have had to edit that text and re-adjust or even recreate the frame, today’s tip will help save you the time from having to edit both the text and frame by simply editing the text.

The following tip has been tested successfully with AutoCAD 2013 and 2014. AutoCAD 2011 doesn’t have the controls to make this tip work as easily and adjustable and I don’t have a way to test this tip in AutoCAD 2012.

MLEADER TEXT BOX 1

Tip: after placing the multileader, adjust the width of the text column since multileaders width are collapsed…

MLEADER TEXT BOX 3

The first thing needed is to set up a multileader “Style” that has the desired text style and height defined

Open the MultiLeader style dialog by entering MLS <enter> in the command line or by clicking on the diagonal arrow in the bottom right of the “Leaders” oanel of the “Annotate” ribbon.

MLEADER TEXT BOX 2

Set the desired text style and heights to your new multileader style and make sure to apply the check mark next to “Frame text” under the “Content” tab. This applies the frame around your text that automatically adjusts.

MLEADER TEXT BOX 4

Apply the Multileader style to the desired multileaders. Notice that there is now a frame around the text. But also notice that there is a leader attached…

MLEADER TEXT BOX 5

To remove the leader:

  • Select the Multileader
  • Hover over the arrow endpoint of the Multileader
  • Select “Remove Leader”

MLEADER TEXT BOX 6

Enjoy your new auto-adjusting text box…

MLEADER TEXT BOX 7

Note: the size of the gap from the text to the frame is controlled by the “Landing gap” setting found in the “Content” tab of the Multileader “Style”

MLEADER TEXT BOX 8

 

Adding Background Mask to Hide background Objects:

  • Double click inside of the Multileader to activate the “Text Editor” contextual ribbon tab.
  • Click the “Background Mask” button that is found on the “Formatting” panel of the ribbon
  • In the Background Mask” dialog box, check the mark next to “Use background mask”
  • Also notice that the offset distance of the background mask is controlled from this dialog box.

Adding Background Mask To HideMLEADER Text Mask Done



Change the “Standard” Font in AutoCAD Template

$
0
0

Some drafting standards require a text “font” that is something other than the “Arial” font, yet AutoCAD seems to keep reverting back to this font even after changing what font the text style is using. Some people almost have conniption fits because their text keeps changing…

Shown below: “Standard” text style using Arial.ttf

Standard Style using Arial.ttf

Standard Style using Arial.ttf

One reason is that the default acad.dwt  that is used for new drawings has this font defined for the “Standard” style. My first suggestion would be to not use a style named “Standard” as this can cause obvious conflicts. But even if you have no control over this, you can try the following:

Navigate to your AutoCAD Template folder and locate the “acad.dwt” file – The below screen shot is of the AutoCAD 2014 template folder.

AutoCAD 2014 Template location

AutoCAD 2014 Template location

Copy the file to another location as a back up in case something goes wrong.

Rename the file so that it is “acad.dwg” not a “.dwt” file

change file type to .dwg

change file type to .dwg

Open the in AutoCAD and change the Text Style in the “Text Style Manager” by using the command ST <enter>

Change the “Standard” style to the desired font under the “Font Name:” dropdown list.

Standard Style Set to "RomanS.shx"

Standard Style Set to “RomanS.shx”

  • Save and close the drawing. Note: Prior to closing, you may want to “SAVEAS” to an earlier version so that other AutoCAD users that use older version of AutoCAD can use this same file.
  • Change the file type from .dwg to .dwt so that it is once again a template file
  • Place the “acad.dwt” file back in the support folder.

View Fonts Used in Styles Without Opening A Drawing

$
0
0

Continuing the previous blog post concerning how to control what font is being used as the “Standard” text style – One issue that has come up is that upon opening a drawing that has the “Standard” text style defined as something other than what your machine has it set as, the text in the drawing is being changed  before the user has any control over it. Therefore they might not even know what the initial font was set as when the drawing was sent to them.

One way to check this is to use the Reference Manager tool that installs with AutoCAD.

This tool lets you see what a file’s needed references are and repath them if they are located in a different location without opening the file. (XREFs, .ctb files, Printer Configuration files [.pc3] fonts…

Here’s how:

Open the Reference Manager tool

Start > All Programs > Autodesk >  AutoCAD (version) > Refernce Manager

Opening the Reference Manager

Opening the Reference Manager

Upon opening, You are prompted to load all references (nested) or only the top level of references. If all you want to see is the drawing in question and it doesn’t have any references, use the bottom option.

Reference Manager Prompt

Reference Manager Prompt

When the Reference Manager loads – Simply “Add Drawings” and navigate to the drawing you need more information about. After “adding” the drawing. Notice that the font and the corresponding Text Style are shown. Simply jot this down and you now know what font goes with what Style.

Reference Manager for Text Style Fonts 2

 


AutoLISP: Convert 2D Solid to Polyline Outline

$
0
0

Since 2D solids aren’t very friendly after you place them and are hard to edit, you may need find this tool helpful for converting the solid into a polyline that represents the outline of the solid.

An example of its use is editing existing drawings… I have been adjusting blocks from an older block library where some parts of the blocks contain “arrowheads” but they are really just 2D solids. This is helpful so that the users don’t actually snap to these arrows. But a few of them no longer conform to our new CAD standards and sadly, some of the geometry was drawn incorrectly. So I have been using this routine to adjust these stubborn objects.

Here’s how:

  • OUTLINESOLID <enter>
  • Select the 2D Solid
Convert 2D Solid to Polyline

Convert 2D Solid to Polyline


;;; Select a 2D solid and this will delete the solid and replace its outline with a polyline
;;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Solid-object-to-Polyline/td-p/783079
;;; Posted By: Schamenek, Alex
(defun c:outlinesolid(/ solid pt1 pt2 pt3 pt4)
   (prompt "\nPlease select the solid you want to outline.")
   (WHILE (NOT (setq solid (ssget ":S" '((0 . "SOLID")))))
      (prompt "\nPlease select the solid you want to outline."))
      (SETQ pt1 (cdr (assoc 10 (entget (ssname solid 0))))
         pt2 (cdr (assoc 11 (entget (ssname solid 0))))
         pt3 (cdr (assoc 12 (entget (ssname solid 0))))
         pt4 (cdr (assoc 13 (entget (ssname solid 0))))
       );SETQ
   (COMMAND "_.PLINE" PT1 PT2 PT4 PT3 "C")
   (command ".erase" solid "")
);DEFUN

Rotate Objects to Reference an Angle

$
0
0

The Rotate command can be used to match an angle of an existing object or allow you to input an angle.

Rotate_Reference_1

 

This tip is especially helpful when you don’t know the angle of the objects. maybe all you know is that the objects need to be rotated to match something else…

Here’s how:

Start the ROTATE command.
The alias to start the command is RO <enter>

Rotate_Reference_2

Select The objects that need to be rotated.

Hit <enter> when finished

Tip: You can Start the Rotate command from the right-click menu. Simply select the objects and then right-click and select “Rotate” Also note the other command that are available from this menu.

Rotate_Reference_1a

Specify the base point for the rotation. The base point is the pivot point that the objects will rotate around.

Rotate_Reference_3

 

Use the sub-option “Reference” of the command by either selecting the blue R in the command line or by using R <enter>

Then pick 2 points to define the angle of the objects. This angle will match the angle in the next step.

 

Rotate_Reference_6

Use the sub-option “Points” by clicking the blue P or by using P <enter> in the command line.

Pick 2 points to define the angle for the rotated objects.

Note: The order of the picked points from the “Reference” option will match the order of the “Points” option of the command.

Rotate_Reference_4

 

The result will be similar as shown below:

Rotate_Reference_5

 

 

Tip: The hot-grip method of the “Rotate” command does not have the “Points” sub-option of the command so it will help have the same result.

Just in case you don’t know how to start the hot-grip method:
The hot grip method lets you start some command without entering a command. You simply select the objects and then click on any grip. Notice how it becomes red? This is a “hot-grip.” Now if you right click, you see a limited (and different) right click menu. You can start other command from this menu.

Rotate_Reference_1b


Missing Hatch Ribbon or Dialog Box setting

$
0
0

Hatch Ribbon 1The hatch ribbon has become the “norm” for the last couple of releases of AutoCAD but you may have switch how you place and edit hatches to the legacy dialog box version. But what happens if you switch to the dialog box version and then want the Hatch “contextual ribbon” back?

Tip: a “Contextual Ribbon” is a ribbon tab that appears only when a particular command is being used or particular object. Another example of a Contextual Ribbon tab is while placing MTEXT (Use the alias T <enter> to place MTEXT…)

Tip 2: From within the Hatch contextual ribbon, you can open the Hatch dialog box by clicking the diagonal arrow in the “Options” panel (shown below)

Hatch Dialog 2

 

The system variable that controls which version (ribbon or dialog box) is HPDLGMODE (shown below).

The out-of-the-box setting which displays the contextual ribbon is <2>

 

 

 

Out of the box Hatch ribbon 1

 

~enjoy


AutoLISP: Closed Objects to Wipeout updated

$
0
0

It has been a while since using this LISP routine, but apparently the routine that was posted a couple of years ago (found here: http://autocadtips.wordpress.com/2011/05/28/autolisp-objects-2-wipeout/) and written by Giles Chanteau stopped working in newer releases of AutoCAD because it now needs to call upon a different .ARX file (AutoCAD Runtime eXtension).

OB2WO 3

The LISP routine creates a wipeout object from selecting a closed object. This might not seem like a big deal since you can do the same thing with the WIPEOUT command, but this routine lets you select closed curved objects with the exception of SPLINE objects.

Here’s how:

  • Load the code below
  • Use OB2WO <enter> in the command line to start.
  • Select  a closed object whose shape from which you would like to create a wipeout (Circle, Ellipse, Closed Polyline with or without arc segments).

OB2WO 4

  • After selecting the object, you are asked if the object that you selected should be erased after the wipeout is created. By default, “No” is selected and the object will remain and the wipeout that is created is placed on the current layer. so make sure that the layer you want it on is set current,
Hatch with various shapes covering the hatch

Hatch with various shapes covering the hatch

The above picture shows a Hatched area with some curved closed shapes.

Shown below, The wipeouts have been created and the original selected object remains.

OB2WO 2

 

Thanks to Giles Chanteau for his routines and for his presence on the various forums always willing to ask and answer question in a pleasant manner, Thanks again Giles

~Greg


;;; OB2WO (gile) -Gilles Chanteau- 10/03/07
;;; Creates a "Wipeout" from an object (circle, ellipse, or polyline with arcs)
;;; Works whatever the current ucs and object OCS
;;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/wipeout-with-arcs/m-p/786490#M12148

(defun c:ob2wo (/ ent lst nor)
  (vl-load-com)
  (if (and (setq ent (car (entsel)))
	   (member (cdr (assoc 0 (entget ent)))
		   '("CIRCLE" "ELLIPSE" "LWPOLYLINE")
	   )
	   (setq lst (ent2ptlst ent))
	   (setq nor (cdr (assoc 210 (entget ent))))
      )
    (progn
      (vla-StartundoMark
	(vla-get-ActiveDocument (vlax-get-acad-object))
      )
      (makeWipeout lst nor)
      (initget "Yes No")
      (if
	(= (getkword "\nDelete source object? [Yes/No] <No>: ")
	   "Yes"
	)
	 (entdel ent)
      )
      (vla-EndundoMark
	(vla-get-ActiveDocument (vlax-get-acad-object))
      )
    )
  )
)


;;; ENT2PTLST
;;; Returns the vertices list of the polygon figuring the curve object
;;; Coordinates defined in OCS

(defun ent2ptlst (ent / obj dist n lst p_lst prec)
  (vl-load-com)
  (if (= (type ent) 'ENAME)
    (setq obj (vlax-ename->vla-object ent))
  )
  (cond
    ((member (cdr (assoc 0 (entget ent))) '("CIRCLE" "ELLIPSE"))
     (setq dist	(/ (vlax-curve-getDistAtParam
		     obj
		     (vlax-curve-getEndParam obj)
		   )
		   50
		)
	   n	0
     )
     (repeat 50
       (setq
	 lst
	  (cons
	    (trans
	      (vlax-curve-getPointAtDist obj (* dist (setq n (1+ n))))
	      0
	      (vlax-get obj 'Normal)
	    )
	    lst
	  )
       )
     )
    )
    (T
     (setq p_lst (vl-remove-if-not
		   '(lambda (x)
		      (or (= (car x) 10)
			  (= (car x) 42)
		      )
		    )
		   (entget ent)
		 )
     )
     (while p_lst
       (setq
	 lst
	  (cons
	    (append (cdr (assoc 10 p_lst))
		    (list (cdr (assoc 38 (entget ent))))
	    )
	    lst
	  )
       )
       (if (/= 0 (cdadr p_lst))
	 (progn
	   (setq prec (1+ (fix (* 25 (sqrt (abs (cdadr p_lst))))))
		 dist (/ (- (if	(cdaddr p_lst)
			      (vlax-curve-getDistAtPoint
				obj
				(trans (cdaddr p_lst) ent 0)
			      )
			      (vlax-curve-getDistAtParam
				obj
				(vlax-curve-getEndParam obj)
			      )
			    )
			    (vlax-curve-getDistAtPoint
			      obj
			      (trans (cdar p_lst) ent 0)
			    )
			 )
			 prec
		      )
		 n    0
	   )
	   (repeat (1- prec)
	     (setq
	       lst (cons
		     (trans
		       (vlax-curve-getPointAtDist
			 obj
			 (+ (vlax-curve-getDistAtPoint
			      obj
			      (trans (cdar p_lst) ent 0)
			    )
			    (* dist (setq n (1+ n)))
			 )
		       )
		       0
		       ent
		     )
		     lst
		   )
	     )
	   )
	 )
       )
       (setq p_lst (cddr p_lst))
     )
    )
  )
  lst
)


;;; MakeWipeout creates a "wipeout" from a points list and the normal vector of the object

(defun MakeWipeout (pt_lst nor / dxf10 max_dist cen dxf_14)
  (if (not (member "acismui.arx" (arx)))
    (arxload "acismui.arx")
  )
  (setq	dxf10 (list (apply 'min (mapcar 'car pt_lst))
		    (apply 'min (mapcar 'cadr pt_lst))
		    (caddar pt_lst)
	      )
  )
  (setq
    max_dist
     (float
       (apply 'max
	      (mapcar '- (apply 'mapcar (cons 'max pt_lst)) dxf10)
       )
     )
  )
  (setq cen (mapcar '+ dxf10 (list (/ max_dist 2) (/ max_dist 2) 0.0)))
  (setq
    dxf14 (mapcar
	    '(lambda (p)
	       (mapcar '/
		       (mapcar '- p cen)
		       (list max_dist (- max_dist) 1.0)
	       )
	     )
	    pt_lst
	  )
  )
  (setq dxf14 (reverse (cons (car dxf14) (reverse dxf14))))
  (entmake (append (list '(0 . "WIPEOUT")
			 '(100 . "AcDbEntity")
			 '(100 . "AcDbWipeout")
			 '(90 . 0)
			 (cons 10 (trans dxf10 nor 0))
			 (cons 11 (trans (list max_dist 0.0 0.0) nor 0))
			 (cons 12 (trans (list 0.0 max_dist 0.0) nor 0))
			 '(13 1.0 1.0 0.0)
			 '(70 . 7)
			 '(280 . 1)
			 '(71 . 2)
			 (cons 91 (length dxf14))
		   )
		   (mapcar '(lambda (p) (cons 14 p)) dxf14)
	   )
  )
)

XREF Load Status App Review

$
0
0

The app mentioned in this post saved my sanity while opening drawings that contained a large amount of XREFs (External References). The “XREF Load Status” app is available from the Autodesk Exchange Apps store in a free version that will only work with XREFs that are .dwg files or a paid version that will work with XREFs that .dwg, .DGN and various image files. I spent the $5 for the full version since I knew that I would be dealing with various file types from time to time. I usually don’t do a review like this but this app needs deserves it.

The app is made by RedTransit Consultants. They have other apps available and also services to develop custom apps as well.

The project that I used this app on had a ridiculous amount of XREFs some of which were huge. Some files referenced over 140 other files and the disk size was well over 350 megabytes and it took multiple minutes to open. And the thing is that maybe the only edit that was needed to be made was a text edit or Attribute edit.

That’s where this app came in to save the day.

Shown below is a well known file that contains multiple XREFs. Lets say you wanted to be able to control which XREFs will open when you open your file. With this app you can control this – it could be a few XREFs or none…

XRLS 1

 

After installing the XREF Load Status APP, it should appear under the “Plugins” tab of the ribbon. Click to start.

Note that you should launch the app from another drawing or in a blank drawing. Basically, you are controlling the XREFs in a drawing without being in that drawing…

XRLS 2

Once the tool starts, you will see the dialog box shown below.
Click the long button  that says “Select Drawing File to Open…

XRLS 3

Navigate to the file and select it and click open:

XRLS 4

The drawing’s XREFs will display in the dialog box and the various option of how the XREFs are loaded will be shown.

Note that the current “Load Status” is shown under the corresponding sides of the dialog box. Files in the left column are not currently loaded (UNLOADED) and the files in the right side are currently loaded

There are a few choices to help you select which XREFs are loaded or unloaded:

  • Sort Ascending – will sort the list of XREFs in alphabetical order
  • Check All – will check all of the check-boxes in the list
  • Clear All – unchecks all of the check-boxes in the list
  • Invert All Toggles – Will let you easily switch the checks in the check-boxes. This is great becasue otherwise you would have to use the select all button and then go through and deselect the XREFs that you want loaded. So – to use this option, you go through the list of XREFs and check the ones that you want loaded and then click this button to “invert” those selections.

Once you have made your selections, you are given the choice of what to do with these changes, You can simply save these setting in that file without opening it and move on to the next one, or you can apply these settings and open the file.

XRLS 5

 

Shown below is a list of the XREFs that are “Unloaded”

XRLS 7

The drawing shown below is the file with all of the XREFs not being loaded upon opening.

XRLS 8

 

~enjoy



AutoLISP: Rotate Multiple Objects Around Their Base Point

$
0
0

There are 2 things in this blog post that I want to point out.

1) Share a LISP routine that rotates multiple objects around their individual base points…

2) The lisp routine shown in this post hasn’t been altered since 1991 and it still works in AutoCAD 2014. This may not seem like a big deal but with all of the various programming languages available to be used within AutoCAD, the power of using a LISP routine that hasn’t had to be changed or updated in over 20 years is pretty impressive.

Rotate Multiple Lisp routine with date shown

Rotate Multiple Lisp routine with date shown

The Routine allows you to rotate multiple objects such as blocks and text objects that have an “Insertion Point”  to a user-specified angle. And instead o0f rotating everything around one base point, the object’s individual base point is used.

In the example below, there is a vertical column of blocks that are rotated clockwise by 90s. I don’t know why, but all that I know is that I want them right-side-up.

Rotate Multiple

Here’s how:

  • Load the routine
  • ROTMULT <enter> to start
  • Select objects
  • <enter> when finished selecting
  • “Enter Rotation Angle:” enter a positive number to rotate the objects counter-clockwise (example 90) and a negative number to rotate the objects clockwise (example -90)

~Enjoy



;* Rotate Multiple
;* Rotates many entities around their respective basepoints
;* allows selection by AUTOCAD selection sets or SSX.
;* Written by David Husch, January 1991

(defun c:rotmult ()
  (prompt "Select Entities to Rotate, <ENTER> for SSX.")
  (setq ss (ssget))
  (if (not ss) (setq ss (ssx)))
  (setq num (sslength ss))
  (setq x 0)
  (if ss 
  	(if (setq ang (getreal "Enter Rotation Angle: "))
	  	(repeat num
		  	(setq ename (ssname ss x))
		    (setq elist (entget ename))
			(setq pnt (cdr(assoc 10 elist)))
			(command "Rotate" ename "" pnt ang)
 		    (setq x (1+ x))
	    	)
	  	)
    )
  )


AutoLISP: Change Text Styles

$
0
0

Today’s featured routine was posted by “Peter” at Augi.com found here: http://forums.augi.com/showthread.php?22959-Help-Changing-text-style-in-blocks

This routine helps changes the text style of text objects and even attributes inside of blocks to a user specified text style. This is helpful for when you receive drawings from another source and would like to change text styles to match your text styles.

For this routine to work, the desired text style must exist in the drawing.

The format of how to run this routine is different than other routines that you might be used to. You load the lisp routine as normal, but there isn’t a command that you enter at the commandline. What you do is pass feed the LISP routine the “function” that runs the routine and then the 2 variables in order for it to run.

The format that you feed the command line is:
(changestyle “oldtextstylename” “newtextstylename”)

changestyle = starts the function (starts the routine)
oldtextstylename = replace this text with the name of the text style that you would like to be replaced. Note – keep the name in “quotes”
newtextstylename = replace this text with the name of the text style that you would like to replace the previous style. Note - keep the name in “quotes”

Text Style Change

 


;;; Changes objects that are set to one text style to another text style. Both styles need to be defined in the drawing.
;;; Posted by Peter
;;; http://forums.augi.com/showthread.php?22959-Help-Changing-text-style-in-blocks
;;;
;;; Use the foloowing format in the command line after loading the routine:
;;; (changestyle "oldtextstylename" "newtextstylename")
;;; 
(defun ChangeStyle (strStyle1 strStyle2 / entItem objBlock objDocument objItem )
 (vl-load-com)
 (setq objDocument (vla-get-activedocument (vlax-get-acad-object)))
 (if (and (tblobjname "style" strStyle1)
          (tblobjname "style" strStyle2)         
     )
  (vlax-for objBlock (vla-get-blocks objDocument)
   (if (> (vla-get-count objBlock) 0)
    (progn
     (setq objItem (vla-item objBlock 0)
           entItem (vlax-vla-object->ename objItem)
     )
     (while entItem
      (if (and (vlax-property-available-p (setq objItem (vlax-ename->vla-object entItem)) "StyleName")
               (= (strcase (vla-get-stylename objItem)) (strcase strStyle1))
          )
       (vla-put-stylename objItem strStyle2)
      )
      (setq entItem (entnext entItem))
     )
    )
   )
  )
  (princ "\nError check if styles exist: ")
 )
 (vla-regen objDocument 0)
)

Text Style Merge 1

 

Text Style Merge 2


AutoCAD Cursor/Crosshair Angle

$
0
0

Have you ever opened someone else’s drawing and the AutoCAD cursor is at some odd angle?

The system variable to help control this setting is SNAPANG.

Below is an example of a cursor at an odd angle while in a layout tab

odd cursor angle

odd cursor angle

A quick glance at the system variable description doesn’t seem to be all that clear, but I know that if I enter SNAPANG in the commandline, it will make more sense.

SNAPANG 2

SNAPANG 3

 

Side note: There are a few “common courtesy” or “drawing etiquette” rules that I wish more people would follow when they exit a drawing. This topic is worthy of its own blog post and I will put one together in the future. But the idea is that before closing a drawing, make the drawing so that the file is optimized for the next guy.

This includes, setting the USC to World, Zoom to a view that isn’t confusing or change to a LAYOUT tab and zoom to the titleblock for the next guy, AUDIT the drawing to fix any errors. Check the SNAPANG and set it to zero…

 

 

 


AutoCAD 2015: Text Align Dynamically

$
0
0

A new feature in AutoCAD 2015 is the Text Align tool found on the “Annotate” tab > “Text” Panel and the button that has 2 stacked letter A’s. The command to start this command is TEXTALIGN <enter> and the command alias is TA <enter>TextAlign1

 

This command works on both MTEXT and DTEXT (single line text) and makes the process of aligning text easy.

(side note: I refer to single line text as “DTEXT” because that is how AutoCAD refers to that type of text.

  • The alias to quickly add DTEXT is simply DT <enter>.
  • The alias to quickly add MTEXT is T <enter>…)

By default, this command uses a text object’s insertion point based on how it it is justified. Below is a selection set of both MTEXT and DTEXT showing the grips of their insertion points.

TextAlign3

You are then prompted to Select a Text object.
The text object that you select will define the first point of alignment by its insertion point

after you select the text, the alignment can be at any angle. The picture below shows the text being aligned without ORTHO turned OFF and the angle of the cursor is at some random angle…

TextAlign4

The picture below shows how the text will look when ORTHO is turned ON and the cursor is pulled up (or down will work as well).

TextAlign5 ortho

 

Below is the result of the aligned text.

TextAlign6 Result

TextAlign Select text

As a good AutoCAD user I hope that you noticed that during the command, there are options. All of the options are helpful but one of them stands out. This is the “Distribute” option.

Distribute Option: This option aligns the text and evenly spaces (distributes) them between 2 points.

The steps shown below are:

  • TA <enter> to start the TEXTALIGN command
  • Select the text objects to be aligned <enter>
  • P <enter> to start the “Points” sub-option
  • Pick the first point (upper line)
  • O <enter> to start the “Options” sub-menu
  • D <enter> to select “Distribute”
  • Pick Second point (lower line)

TextAlign Distribute

 

Make sure to check out this AutoCAD help link for more helpful info about the features of this command: http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-CC1BE498-4908-434E-8FDA-0DE87E05EA15


AutoLISP: Dynamic Text Align

Viewing all 89 articles
Browse latest View live