This code will use the collection object to quickly determine if data is a duplicate. It uses the .add method and will return an error if the data is already in the collection and wont be added. We can also use .count method to see if that item was added to the collection or not.… Continue reading Find and Delete Rows With Duplicate Data
Tag: vba
AddSpline Method
This example will grab scanned data from an excel file and create a visual representation of the scan data in AutoCAD by drawing splines. I haved uploaded the excel file for viewing reference Scan Data_to_Autocad.xlsm Results: Drawn Splines Excel Scanned Data Option Explicit Public MTextObj As AcadMText Public ACLayout As AcadLayout Public acadApp As Object… Continue reading AddSpline Method
Grab Attribute Data from Dwg Files in a Folder
This example will let user select a folder that contains dwg files. It then opens each drawing and extracts attribute data from all the blocks. The data is then put in an excel table. The table is then sorted according to the y coordinate insertion point of each block. For this example I have a… Continue reading Grab Attribute Data from Dwg Files in a Folder
Delete All Drawing Objects
This is useful when you are creating drawings from a template that has inserted blocks or pre-drawn objects. It is also helps when creating many CNC drawings. Instead of creating a new drawing each time, just create one drawing, create objects, save as, delete all, create objects, save as, and repeat until all the CNC… Continue reading Delete All Drawing Objects
Editing Dynamic Block Attributes
Paste the following code into excel VBA module. Next add a folder named 'support' and put the dwg file that has all your dynamic blocks. Keep the 'support' folder in the same folder as the excel workbook. See this post on creating dynamic blocks https://pearlsnake.com/2019/05/20/creating-dynamic-blocks-in-autocad/ . I have also uploaded a folder called 'support' on… Continue reading Editing Dynamic Block Attributes
TranslateCoordinates/TransformBy Methods
This example shows how to use TranslateCoordinates and TransformBy methods, which are very helpful when drawing 3D objects in autoCAD with VBA https://www.youtube.com/watch?v=j_07Jjd-pJk It first draws a closed polyline on the orginal UCS. The original UCS is given a name 'OriginalUCSj' so that we can activate the original UCS again. The polyline is then moved… Continue reading TranslateCoordinates/TransformBy Methods
Fillet all Corners of all Polyline objects
This code will fillet all polyline objects on the active autoCAD document from an excel module. This is useful when you have CNC object that will be cut on a plasma cutter and cant have sharp edges for safety reasons. Each fillet will have a radius of 0.25 . The radius can be changed by… Continue reading Fillet all Corners of all Polyline objects
How to use ArrayRectangular
This code will draw a rectangle with holes in an array. It will then save the file as a cnc file with a job number, description, and time stamp. All of the parameter can be customized with excel inputs. First, paste the following code into an excel module. In this case I put in Module1… Continue reading How to use ArrayRectangular