The code below will draw a viewport in paper space and zoom to an area in model space. It will then create a circle in model space and then change that circle to to papers pace while still keeping the circle in the same location. Note: for this to work, the MSpace has to be … Continue reading Veiwports with TranslateCoordinates and CHSPACE
Category: autocad
Viewports and Dimension Scales
Often times its nice to create a drawing package where all the geometry and dimension and text are drawn in model space and want to make different layout tabs showing all the different geometries in the model space. We want all the text and dimensions to be the same size throughout all the print pages. … Continue reading Viewports and Dimension Scales
Find Intersect Between Two Block Objects
This code will create two blocks that have a light weight polyline of a triangle and a trapezoid. We want the two object to have a specific gap between them without intersecting. WE CAN DO THIS! No Calculus required. We do this by exploding the block and then offsetting the polyline a specific distance with … Continue reading Find Intersect Between Two Block Objects
Change Tags of all MultiLeader objects
This example shown is for a custom multileader that has additional attributes; although with slight modification it can also work with standard multileader. This is useful when trying to match the pcmarks with the Bill of Material items in a table. The code can be expanded to loop through a BOM table, for simplicity I … Continue reading Change Tags of all MultiLeader objects
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
Creating Dynamic Blocks in AutoCAD
Dynamic Blocks are useful in cutting down the lines of VBA code. Below I show how to create Parameters and assign actions to each of the parameters. Note: instead of adding mtext in the block. Add a block attribute with Attdef command. This way the pcmark can easily be changed with code. https://youtu.be/gzWEmUXUWU0 quick demo … Continue reading Creating Dynamic Blocks in AutoCAD
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