Draw on UCS Front View

Instead of drawing on the default top view. The code below will show how to draw on the front view ' set the world ucs With acadDoc Set currUCS = .UserCoordinateSystems.Add(.GetVariable("UCSORG"), .Utility.TranslateCoordinates(.GetVariable("UCSXDIR"), acUCS, acWorld, 0), .Utility.TranslateCoordinates(.GetVariable("UCSYDIR"), acUCS, acWorld, 0), "OriginalUCS") End With 'Create a UCS and make it current origin(0) = 0: origin(1) = 0: … Continue reading Draw on UCS Front View

Add a Viewport and Show Front View

This will create a viewport in paper space and instead of the standard top view, the viewport will show as the front view center(0) = 5.4682: center(1) = 1.4055 dblviewdirection(0) = 0: dblviewdirection(1) = -1: dblviewdirection(0) = 0 Set pviewportObj = acadDoc.PaperSpace.AddPViewport(center, vpwidth, 2.2565) pviewportObj.direction = dblviewdirection pviewportObj.Layer = "viewport" pviewportObj.Display True acadDoc.MSpace = True … Continue reading Add a Viewport and Show Front View

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