Saturday, August 30, 2008

LINE of given length and direction

This small routine will draw a LINE of given length in a given direction.

Sequence of command lines for this routine:-

Command: LLD
Pick Start point :
Show direction or Enter angle :
Enter distance :


;CODING STARTS HERE
(prompt "\nType LLD to run....")

(defun C:LLD (/ pt1 ang1 dis1 pt2)
(setq pt1 (getpoint "\nPick Start point :"))
(setq ang1 (getangle pt1 "\nShow direction or Enter angle : "))
(setq dis1 (getdist "\nEnter distance : "))
(setq pt2 (polar pt1 ang1 dis1))
(command "line" pt1 pt2 "")
(princ)
)
;CODING ENDS HERE


Save this as "LLD.lsp".

Friday, August 29, 2008

How to know the total number of any "text-value"?

Here I come up with another simple but interested routine.
Say you have a ground Floor plan of a commercial building in which you put a text with the value read as "SHOP" in all the rooms which are designated as SHOPs.

This routine will help you to find out the total number of shops in the drawing instantly. Just pick any text value of "SHOP". Within a milli-second, this routine will show you the total number of text entities placed in the whole drawing as "SHOP".
Howzat??
Isn't it good? Cheers.....!!

P.S.:
This selection will also saved thru out the drawing session. i.e. If you want to select all the texts (named as "SHOP") again, then just type
!V1
at the Select objects: prompt.


* TotalNoOfPickedTEXTs.lsp (1Kb)
This command finds out the total number of any picked TEXTVALUE.

Sequence of command lines for this routine:-

Command: TXTV
Pick text entity:

Download : TotalNoOfPickedTEXTs.lsp

Thursday, August 28, 2008

How to find "Modified Dimension" ?

Some times we want to know how many dimension entities in the drawing (or in a selection-set) have been modified?
Some times we want to select all of these "modified dimensions" and change them back to their original values.
All of us better know how to change them back to "original-value" i.e. we have to just replace"<>" to that modified value.
But ... but ....
how can we know that which dimension is modified & which is not?

Below you can find the required LISP file.

* FindoutModifiedDIMENSION.lsp (1Kb)
This command finds out modified DIMENSION value.

Sequence of command lines for this routine:-

Command: MDM
Select objects:

Download :
FindoutModifiedDIMENSION.lsp

Tuesday, August 26, 2008

Instant Erase ...!

ERASE all POINTs / NODEs

Some times an AutoCAD draftsman wants to erase all the "POINTs/NODEs" within a selection area or from whole drawing. It requires 2 separate commands...
  1. Filter out POINTs/NODEs from the whole drawing or from a selection area
  2. Applying the command ERASE

But the following single command will instantly erase "POINTs/NODEs" within a selection area or from whole drawing.

(Instead of POINT you can use any other entity type as required such as LINE, CIRCLE, TEXT etc. Please change the POINT to your required entity type in the coding below.)

;COMMAND = ESE

;CODING STARTS HERE
(prompt "\nType ESE to run....")

(defun C:ESE (/ sep)
(setq sep (SSGET '((0 . "POINT")) ))
(command "erase" sep "")
(princ)
)
;CODING ENDS HERE


Save this as "ESE.lsp".

Monday, August 25, 2008

AutoCAD plot stamp removed!

For the users of AutoCAD 2007 (& above), there have been a problem of finding a "plot stamp" as ...
PRODUCED BY AN AUTODESK EDUCATIONAL PRODUCT
added on all four edges of any print of any drawing if they are using Educational (Student and Faculty) version of AutoCAD.

This problem affects all the other drawings (which are not from "Educational version") i.e.

  • when we try to copy some entities from the "plot stamped" drawing
  • when we try to get a "plot stamped" drawing as an xref / block

I have tried hard to find its solution by trial & error as well as web searching.
Here is the solution, which I have found it very much useful & also I am using it continuously without facing any difficulty

First you must have 2 more versions of AutoCAD loaded in your computer. i.e.:
AutoCAD ver.2000
AutoCAD ver.14


Then follow the procedure below:
1. Save the drawing (from which you want to clear the "plot stamp") as an AutoCAD-2000 ver. drawing
2. Open this drawing in AutoCAD ver.2000
3. Save this as an AutoCAD ver.14 drawing
4. Open this in AutoCAD ver.14
5. Save it & close it.
6. Open it (or Save it) in any version of AutoCAD {other than EDUCATIONAL 2007 ver. } & print.

You will not find the "plot stamp" again !!

Another simple method is :

Save the drawing as "dxf" format, Open this dxf file in AutoCAD & then again save it as dwg format.

Friday, August 22, 2008

Filtering lines/Plines of given length

There is a line with an specified length (say 60cm) in a drawing which represents an "electricity light" symbol. Remember this is not a "block". And we have to count the total number of "light-symbol" with a given line-length of 60cm.
Ofcourse we can use FILTER command. But there is'nt any option in FILTER, to filter out the line with a given length.
So is this LISP... :)

* FILT2.lsp (2Kb)
This command filters Lines/Plines of given length.

Sequence of command lines for this routine:-

Command: FILLP
Pick source LINE/PLINE:
Select objects:


Download : FILT2.LSP

Wednesday, August 20, 2008

JOIN multiple LINES as a single PLINE

This command join any number of selected LINES as one PLINE.
COMMAND = JPL

;CODING STARTS HERE
(prompt "\nType JPL to run....")

(defun C:JPL (/ jsel)
(setq jsel (ssget))
(if (> (sslength jsel) 1)
(command "pedit" jsel "y" "j" jsel "" "x")
)
(princ)
)

;CODING ENDS HERE

Save this as "JPL.lsp".

Tuesday, August 12, 2008

AutoCAD Single line commands

AutoCAD One line short-cuts. Type these on command-prompt.

;Instant ERASE with crossing-window...
(COMMAND "ERASE" "SI" "AUTO" "c")(princ)

;FILLET with crossing-window...
(COMMAND "FILLET" "C")(princ)

;Sets FILLET radius to zero.
(COMMAND "FILLET" "R" "0")(princ)

;Rotate any object @ 90° from its pick point.
(setq rsel (entsel) rp1 (cadr rsel))(command "rotate" rsel "" rp1 "90")(princ)

;Break an ARC/LINE/PLINE in 2 pieces from its pick point.
(IF (< (GETVAR "OSMODE") 16384)(SETVAR "OSMODE" (+ (GETVAR "OSMODE") 16384)))(setq bsel (entsel) bp1 (cadr bsel))(command "break" bsel "F" bp1 "@")(princ)

;Saves a previous selection by name "s1". Type "!s1" (at Select Object prompt) to retrieve this selection set at any later time.
(setq s1 (ssget "p"))

;This command creates continuous hatching.
(setq ent (ssget))(command "hatch" "" "" "" ent "")(princ)