Re: Auto increment numbers There is a command called TCOUNT in AutoCad 2005 that does the incremental numbering I don't know if it exists in AutoCad LT though. CAD blocks are named groups of objects that act as a single 2D or 3D object. You can use them to create repeated content such as drawing symbols, common components, and standard details. Blocks help you save time, maintain consistency, and reduce file size by reusing and sharing content rather than re-drawing it every time you need it.
1 Mar, 2007By: Tony Hotchkiss
CCAD's AutoCAD Tutorials Auto Number and Convert to Mtext. Learn how to add a numeric incrementing prefix or suffix to text and convert single line text to multiline text using Auto Number and Convert to Mtext. I have a drawing in AutoCAD 2010 with a HVAC design for a building. I setup 2 blocks one for a specific HVAC return and one for diffusers with a attribute of PART in the block editor. The blocks were inserted multiple times throughout the design. Now I start the Data Extraction wizard and have it automatically select all content. After saving a extraction template, select the option to display blocks with attributes only.
Add circles and sequence numbers to semiconductor chip schematics.
Rohaya Shaffini of Stats ChipPAC Ltd. Skyrim npc editor 0_75_1. requested a routine to add circles and sequence numbers to a schematic of a rectangular integrated circuit chip drawing (see a typical schematic below). Rohaya requested that the circles be offset by an amount selected by the user. Plus, he wanted to indicate the start location for numbering, the circle radius and a choice of clockwise or counterclockwise numbering direction.
The solution is TIP-NUM.LSP that lets you select all of the tips surrounding the main rectangle by using a window. You select the upper-left point first and then choose the lower-right point.
The program then asks for the start point for the number sequence, the number direction (clockwise or counterclockwise), the offset distance from the tip to the circle and the circle radius.
Get the Code
Download the TIP-NUM.LSP file from Cadalyst's CAD Tips site. Save the file in AutoCAD's Support directory. Use the Appload facility by selecting Tools / Load Application, and then use the browser to select the file.
How to Use the TIP-NUM.LSP Code
To start the program, enter TN and the prompts appear. The tips should have three line entities (not polylines), and you should select them by indicating the upper-left and lower-right locations. The tips should be on a layer that is reserved for them alone. The start point for numbering expects that you select an endpoint of a tip, and this will be one of the corner tips, as numbering should start at any of the four corners. The number direction prompt as displayed as Number direction: <Cw>/ccW:, where the default is clockwise. For counterclockwise numbering, only enter the W point. The other prompts are for offset distance and circle radius. The program then automatically draws the circles and numbers on the current layer of the drawing with no further input (see below for a typical result).
Programming Notes
The program starts with my usual error handler and system-variable management functions. If an error occurs during the program for any reason, such as a cancellation by the user, any system variables that have been changed are reset to their previous values by calling the Resetting function.
Program major functions
TIP-NUM begins with some standard code so that AutoCAD recognizes Visual LISP functions and sets global variables for the current drawing, model space and utility functions. TIP-NUM calls the function GET-INPUT, GET-CIRCLE-DATA and DO-CIRCLE-AND-NUMBER, as shown here: Free Autocad Dwg Blocks
GET-INPUT, as its name suggests, is the function that asks for user input. The utility methods in Visual LISP are used throughout. As an example, a point is input as an object using the GetCorner method as follows:
Here, the points p1 and p2 are objects rather than entities and are used with the subsequent select method as shown in the last line of this code fragment.
At the end of GET-INPUT, a start location is created as a global variable *startloc* to indicate whether you selected the start point at the upper-left, upper-right, lower-left or lower-right of the schematic. Later in the program, this determines the sort order of the tip line objects. To keep track of the numbering, I decided to collect the horizontal and vertical parts of the tip lines into left, right, top and bottom groups.
The GET-CIRCLE-DATA function performs this grouping after filtering the selected objects by using the layer of the tip that was selected at the start-point prompt. The code for this is:
The horizontal and vertical lines are then grouped into a list, and the rest of the selected lines (the sloping lines) are collected into another list. The lists are sorted via a call to the SORT-LISTS function. There are four lists of lines to sort representing the top, bottom, left and right horizontal and vertical lines. Each of them is sorted depending on whether you select a clockwise or counterclockwise direction. For each of the clockwise or counterclockwise sets of lines, the order of appearance in a list of all lines changes. The conditional function to do this for the clockwise option is as follows:
The data is now in the form of a list of points representing each end of the sequence of horizontal and vertical lines. That list of points is subsequently compared with the x and y coordinates of the remainder of the lines to collect them into a larger list of trios of lines for each tip. The tips were then categorized into four types representing the top, left, bottom and right rows of tips, and the circles and text were added for each type as shown in the following code fragment for the type 4 lines:
Download firmware samsung galaxy sl i9003. The text insertion point is set in the above code and differs depending on the orientation of the tip lines. In the above, the text insertion point IPT was at a sloping distance of 3X the circle radius and shifted downward by the value of the circle radius as shown, before the call to DO-TEXT is made.
Free Autocad Block Library
The text height is set at 1.5X the circle radius and the text string was added as follows from the DO-TEXT function.
As always, I look forward to receiving your comments and requests for 'AutoLISP Solutions.' Contact me using the links below.
Here’s a way to count the blocks in your drawing.
Use the command BCOUNT and you can individually select blocks, use a window selection or type ALL at the command line and every block in your drawing will be selected. After you make your selection set, hit <enter> and in the command line, a list will show the name of the block and the number of occurrences the block either appears in your selection set or if you entered “ALL,” it will show how many times every block appears in your drawing.
To see a more full list, hit F2 and a window will pop up. This window is your command line in a bigger format and it allows you to see your command history more easily. And in this case, allows you to see your list of blocks better.
From this list you can select the list and copy and paste it into a text editor if you needed a text file of your blocks (just an idea…)
(I promise, that when I figure out how to post code using the blog editor, I will post some AutoLISP/VisualLISP codes that do a better job at counting blocks)
Advertisements
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |