Sample autolisp files




















Do the following to use this routine. The selected shaders should be in a layer that describes the type of area to be obtained, by default the lisp will read two layer names, which are the following: « ShadingCut " Y " ShadowFill «.

The lisp adds all the areas of the shadows that are in the layer « ShadingCut »And all the shading areas of the layer« ShadowFill »And once the selection of the slabs is finished, the attributes of the block of areas are updated. The selection of the objects is done by means of a window that includes all the punctures including the text of the progressive of the section. This command Autolisp routine obtains the slope value of a line or a polyline, and also obtains line length, horizontal length and angle.

Provides great help when we want Control our earrings , To obtain the slope, simply select the line or polyline, the result can be displayed on the screen command line or by selecting a text the value of this text will change by the value of the slope found.

It is worth emphasizing that in the case of a polyline, this command finds the slope of only the first segment. This is a Lisp-generated routine that gets the sum of the lengths of the selected polylines or lines, the result of this sum can be set in a text by selecting it or it can only be displayed on the command line.

The default decimal number of the sum of the lengths found is 2, but another value can be entered. This is a small routine that generates a list with the names of all layers in the current drawing and displays it on the command line. Load the lisp file in AutoCAD. Enter the name of the command: lc The result will be a list in the command line of all the layers of the current drawing. This routine generates a table with the specified number of rows and columns, it is similar to the AutoCAD table command, but lighter to use.

This routine Generates a table with the number of rows and columns specified , is similar to the AutoCAD table command, but lighter to use, although it does not link data with Excel you have the option to fill the table with a predefined value which by default is «0.

The objects from which you can export these coordinates are points, texts and blocks, just select them and indicate a destination file of the coordinates. You must have special Care in case the objects are texts , Since the point of insertion that is taken into account at the time of exporting the coordinates, Depends on the justification that these texts have , If you are sure that the justification of the texts is correct there is no problem in exporting the points.

It is advisable to select objects That have a single insertion point, such as Blocks or points of AutoCAD , That way it is safer that the exported coordinates are the ones that correspond. As we mentioned earlier, this routine exports coordinates from points, texts or also Mtext and blocks, but You can supplement the source code to take into account other entities Such as: circles, initial points of lines, among other objects that in its database have the code The coordinates exported correspond to the Starting and ending point of the lines , So in case the lines are joined by the same point, the lisp will read 2 times the same coordinate.

This routine generated for use in AutoCAD and its vertical applications, will allow you to insert the coordinates of points from a file of Microsoft Excel, with this routine it is not necessary to specify details related to the file to be imported, since through its interface you will have within reach the options Necessary to import the points as you wish.

It allows you to choose among 3 different types of ways to insert a point object in the read coordinate. Also You can control the number of decimal places in the inserted dimension text , The scale that will have the label, the rotation of the same whose base point is the location of the imported point and the separation of the label with respect to the point, these options can be stored with a name, so that you can call them according to the points that you will import.

All these options will allow you to import your points from an Excel file quickly and with a clear appearance, it is worth clarifying that the way the texts of the label of the point are seen does not depend on the routine, But the current text style of your drawing and the current layer. Some time ago I published a routine developed by a user, which allowed to import the coordinates but from a text file but with many limitations, this time through this new command we will have more options to control the insertion of coordinate points.

The attached file also provides an example block that you can import, apart from a spreadsheet with the correct format that the command needs to import the coordinates without any inconvenience. This command allows you to import areas default cut and fill to cross-sections of terrain, areas to import must be in a CSV comma-delimited file, according to the attached sample file.

This command reads the progression located in the first column of the csv file and searches for the text with that same progressive in the drawing file, inserting its corresponding cut and fill area in the upper right of the cross section. If you work with images, it has often been necessary to generate a list of them, including their location path, with this routine you can generate a list with the paths of all the images inserted in the current drawing. This routine does not require the input of any option , simply call the command and immediately will be displayed in the AutoCAD command line, the list with the paths of the inserted images.

This routine developed in Autolisp, allows us to update any text, with the path and name of the current file. This is a good help when updating the letterhead of the plans with this information. In the path obtained also includes the name of the current tab, if it is in the model space, it will show at the end of the path: model, otherwise it will show on behalf of the current tab.

The 8 command provides different types of formats for this date, ranging from a simple date type to a long format date type, where the name of the day of the current date is programmatically obtained with AutoLisp.

You can select type entities Text y Mtext , These will be replaced automatically by the current date with the format selected, the available date formats are those shown in the illustration, each one is identified by its number, which will serve to choose the format when requested on the command line Of AutoCAD. This new command obtains the dimension value Y coordinate of a given point and sets it as the content of the selected text. This routine is very useful for example when working with terrain profiles and we want to obtain the height of a vertex and set it in one of the texts that indicate the terrain dimension, it can also be used when working with cross sections of terrain and You want to obtain the dimension value in the section axis and set it in text that will indicate that dimension value.

In this command you can indicate which scale will have the dimension to be set in the text, it is not the height of the selected text, but the scale that has the profile or section to indicate, if your profile for example is scaled 10 times In the vertical, you must set the 10 NC command to scale as a, so that the command, make the corresponding division and set the appropriate value in the selected text.

This is a routine made in Autolisp that allows us to set a dimension value Y coordinate at a given point. This command requests data points and values and performs operations to obtain the final value to be set in the Y coordinate of the indicated point changes the value of the coordinate of the UCS Universal Coordinate System at a point indicated by the entered value.

To verify that the entered dimension has been established at the indicated point execute the command ID, indicate the point, and observe in the command line that the value of the Y coordinate is now with the value entered. This command allows you to find areas indicating an internal point between objects or by selecting closed contours, this command shows the area obtained or otherwise sets it in a selected text.

Here you must indicate the internal points from which the area will be obtained, the other options are described below:. Select object: Instead of specifying internal points to find airs, you can select closed polygons to find your area. Options: This option loads the Command Options dialog box, the dialog box is as follows:. Number of decimals: The number of decimal places the area will have 2 by default.

Height of text to insert: If you decide to insert a text with the area obtained, here is set the height that will have said text. The command shows if the conversion is active and which of the operations is carried out and with what value the conversion will be carried out. This option allows you to customize the areas when the drawing is in different scales or in other drawing units.

Apply shading: This option allows each indicated area to be shaded to have a better view of the area that is being found, thus allowing to verify if it is correct Enabled by default. Name of the shading: Here you must indicate the name of the shading to be applied in the indicated areas Solid default. Shading Scale: Here the scale factor of the shading is indicated, this factor is variable according to the type of shading selected.

Color shading : The color that the shading will have applied in the indicated areas. Finishing the shading: The options below apply once the command application is terminated. Hold contours: If enabled the generated contours are not deleted. Hold shading: If enabled the generated shadings are not deleted. Insert text area: This option allows you to insert a text with the area obtained instead of selecting one to replace it. This small routine performs the same as the previous one, the difference is that the name of the layer is not entered here to select the objects, but an entity is selected from which you want to obtain the name of the layer.

As in the previous routine, the selection of entities is not visible, but exists as a set of selected entities, so the selection mode should be indicated « Previous »To select objects.

When it comes to removing objects outside the polyline, special care should be taken as This command deletes all objects outside the polyline. The polyline to select Must be a closed polyline, otherwise the routine joins the last point of the segment with the first , Closing thus by means of an imaginary line the polyline and eliminating everything that is inside or outside that line.

The option cut as it is logical, only works with objects that can be cut manually, As for example, lines, circles, arcs, etc, blocks and other compound objects do not fit inside these objects that can be cut out. With the lisp a sample file is attached So that the corresponding tests are done before using the command in final files. It is a lisp routine that allows you to select all entities that are in the indicated layer, does not distinguish color or other property that may have the entity.

This routine is not case sensitive at the time of entering the name of the layer, so you can enter in any way, just that it is well written. It is a routine made with the autolisp programming language, it allows us to copy the content of a selected text, and set that value in a second text to be selected.

It should be noted that the language used in this routine is clearly AutoLisp, in a new entry we will publish the same command but written in VisualLisp, in which we will observe that the size of the structure is further reduced.

This lisp routine allows you to change the number of decimals of the selected texts without losing the original number of decimals, with that you can display a number for example with 2 decimals, but internally it will have a new property with its originally defined value.

This new property can only be accessed by this command, since it is not listed by the Properties dialog box. The lisp allows you to change the number of decimals or obtain the original number of a text formatted earlier with this routine, So you know how many decimals you had originally If you want to reset the original values.

This new command could be compared to the action of To change Excel decimals , But the only observation is that this property is internal and as we said earlier The Properties window is not ready to display extended date entities.

Particular consideration must be given to The selected texts are numerical texts , that is, they only contain numbers, since otherwise their value will be converted to « 0. Routine developed with AutoLisp that allows us to align several texts based on the first one selected.

The program allows you to align the texts vertically columns or horizontally rows , for this you only have to select the first, which will serve as a basis for aligning the other texts. It should be noted that the point taken as a basis for aligning the texts is the insertion point, if all the texts have the "Left" justification as an insertion point, they will all be aligned with respect to this point and will be a uniform alignment. If the texts have different justification, all will be aligned with respect to their insertion point which will make the alignment of the texts not be uniform.

This routine created in AutoLisp copies the height of a selected text and establishes it in the texts that are selected later, changing the height they had. For example, if you have 3 texts, the first one has a height of 3 and the next two have a height of 6 and you want the two seconds to also have a height of 3 instead of 6, it is enough to first select the text whose height is 3 and then the texts that have 6 height. This program made in Autolisp and Visual Lisp, allows to select a text, to copy the value of the content and to establish it update in an attribute that is part of a block.

That is, if we want to update an attribute of any block, for an existing text, simply select the text first and then the attribute and it will be updated according to the value of the selected text. As we can see, this command is very useful if we want to update a value of an attribute from a particular text. This routine generated in AutoLisp allows us to modify the heights of the selected texts by changing them according to a percentage entered.

For example if you have two texts, one with height 0. This routine is very useful when it is required to make changes in the heights of many texts with different heights.

When you have a block with many attributes, it is very tedious to have to delete the content of many of them, usually double click on the selected attribute, wait for it to load the dialog and proceed to delete the content. To avoid this tedious work, This little routine will relieve you a little of the time you spent in performing the task described above. With this command you only have to select the attributes that you want to delete the content. You must verify that the texts that are in the block are attributes sometimes confused between them , so that the routine works correctly.

Mind you, this command Only deletes the content of the attribute, but not the attribute itself of the block. Some time ago I shared with you a routine that copied the value of a text and established it to another selected text, this time this routine will allow you to get the value of a selected text and will establish it to several texts that you select. The use of this new command is very simple, you just have to select the text from where you want to copy the value and then you must select all the texts that you want to replace with this new value.

It is a lisp that contains two commands: Increase and Reduce, these commands allow to modify the height of the selected text, increasing it or reducing it of size according to the chosen command. The size change is done for each click made in the text and is done according to a factor indicated in the source code of lisp, this factor is 1.

The initial height of the text is multiplied by 1. For more information on how high the text is each time it is clicked, the routine displays the resulting height for each change in height made in the text. This command is very useful when you want to increase or reduce heights of texts in proportion, without having to have a specified final height, only visual. Routine in VisualLisp allows to increase the value of the numbers of the selected texts. This routine generated in VisualLisp allows to increase the value of the numbers of the selected texts one by one according to an indicated increase factor.

For example, if the initial value is the 1 number, and an increment value of 1 is entered, subsequent selected numbers will be incremented by one unit, the next 2, the next 3, and so on. Some time ago I got this interesting lisp routine and although lately I have not used it, every time I have needed it has helped me enormously with volume calculations, this as a complement in the moments that civil 3D fails to give me the results I need.

It is a routine in which Selecting 3Dface objects, extruding them together and converting them into a single 3D Solid object , Its use is simple and just simply select the objects and the routine will do all the work. For a greater appreciation of the changes that the routine makes in the objects, You need to have an 3D view , Otherwise in view of plant will not be observed the heights created in the 3D Solid , because the solid is created by the projection of each selected face, vertically "down" of the current z-axis , To a plane and to a distance specified by the user.

To ensure that all parts of the mesh are generated as solids, This distance can not be zero, But the solid can be cut later if necessary to the required thickness, with boolean operations or solids editing operations.

The resulting solid is created in the current layer. If at the end of the union of the small solids, The operation stops or hangs Due to memory limitations, You can try to join them manually. If adjacent faces do not have identical coordinates , There will be very small gaps or overlaps between the solids derived from them, which may be because AutoCAD can not be able to join the solids, showing the following messages:.

On several occasions you will have found that you have contours in a file, but these do not have their quota, through this routine, you can insert dimensions in the topographic level curve that you want. The dimensions to be inserted are blocks with attributes, these blocks are created in a drawing in millimeters.

So that you can use this lisp without problems, you will have to use the command « UNITS » Units define the units of the content to be inserted in« millimeters » Millimeters. The scale requested by the routine refers to the scale on which the drawing will be plotted, it is a referential value of the text size of the dimension to be inserted, you can try incrementing or decreasing this value until the dimension is inserted with the size of text you want.

This routine draws the lines of the cut or fill slopes, these slope lines are necessary to indicate or represent the unevenness between the platforms. In order to generate the slope line with this routine, 6 data must be entered which will allow the slope lines to be generated as expected. This routine allows you to draw a line with the slope that you indicate, just indicate the insertion point of the line and the slope that will have.

The slope is indicated by a value with respect to 1, for example: if you want to draw a line with a slope of 2: 1, only the 2 number should be indicated as slope for the line if the slope to be obtained is 1: 1. For further clarification, if slopes with the value of 1 first 1: x are desired, divide 1 between the complementary slope x. With this simple routine you can draw a line with the slope that you indicate, for this it is enough to indicate the insertion point of the line and the slope it will have.

The line is generated with a horizontal length of 10 units and a vertical length of the value of the slope indicated between With this lisp routine you can find the cut and fill areas from a cross section that has a Natural Terrain line and a grazing line section of the final road. For this lisp to find the areas, you must make the selection of the terrain and grazing polylines and the command will ask for a point to insert the texts of the corresponding areas found.

This routine allows you to insert the slopes of a longitudinal profile polyline or line on the guitar. Simply select the profile the polyline and indicate a point that corresponds to the vertical location of the texts that indicate the slopes.

If it is a line, the command calculates only the endpoints, thus finding the slope, in the case of a polyline, the routine obtains each initial and final vertex and calculates the slope between them of all the segments of the polyline. As in the previous routine, the current text style should not contemplate a height , If you have an error and the slopes will not be inserted.

The scale indicated at the beginning of the routine is only for the sizes of the texts and does not influence the measures taken to process the slopes. This lisp routine is an adaptation of the previous one and allows you to insert a mark in all the vertices of the polyline that you select, just select it.

The inserted mark is a drawing file block generated for a particular scale, but it is totally customizable, it can be edited like any drawing, it must only respect the center point of it in this case the center of the circle of the block. In the source code of the file you can choose to insert a circle instead of the block, for that you only have to remove the comments of the line that contains this code and comment the line that inserts the block. This method of loading Lisp files first checks to see if the routine is already loaded.

If it is, it runs the routine. If it is not, it first loads the routine, then runs it. Clever Hey? The Acad. Lsp file is a useful way of loading a library of AutoLisp routines. Each time you start a drawing AutoCad searches the library path for an Acad.

Lsp file. If it finds one, it loads the file into memory. You could use the normal load function load "filename" in your Acad. Lsp file but if an error occurs whilst attempting to load one of your routines, the remainder of the file is ignored and is not loaded.

Therefore, you must use the on failure argument with the load function :. Reduce Polyline Vertex. Insert Vertex along a Polyline. Quality Check Polygons. Move Text Objects. Create Co-Ordinate Table. Export Polyline Vertex. Mark Intersections. Find Open Polygon. Convert Smooth Polyline.

Smoothen Cross Section Line. Smoothen the cross-section line to represent it as a natural surface. Convert Face to Polyline. Create Centre Line. Find Intersections. Measure Line. Break all intersecting Polylines. Recreate Polygon in Clockwise Direction. Offset Polyline on either Side. Sort Polylines by length. Export Polyline Coordinates. Block Lisps. Insert Block at Segment Midpoint. Text from selected Attribute. Insert Block on Polyline. Insert blocks at the intersection or end or a combination of intersection and the endpoint among the selected polyline.

Insert Block at Vertex Point. Routine to insert block at each vertex of the selected polyline. Elevate Block.

Lisp routine to elevate blocks using the nearest elevation text. Insert Block on Text. Insert blocks by finding specified text in the whole drawing. Check Missing Numbers in Sequence. Find the missing number in a sequence starting from smallest number to highest number among selected text. Change Precision. Find Difference in Over Lapping Text. Interchange Texts. Rotate Text. Copy Text to Many.

Select Texts Containing. Select the texts having specified text among the selected texts. Find Overlapping. Round off Values.

Box around a Text. Circle around a Text. Export Point Data. Import Point Data. Utility Lisps. Create a callout cloud-like object around the important text in the drawing. List DXF Details. Multiply selected entities with a given multiplication factor. Change Layer to Current. Quickly Create Layers. Delete Layer. Delete all the entities of layer determined by the selected entity. Set Normal UCS. Set normal UCS to all the selected entities. Scale Line. Scale selected lines from mid-point with a given scale factor.

Arc to Line. Elevate Elevation Text. Utility Programs. Excel Macro. Plotting of Spot levels in different Colour in your cad package with the help of this macro.

Excel to CAD. ESurvey Shape. UTM Converter. CAD Batch Runner.



0コメント

  • 1000 / 1000