autocad

Move Coordinates of Polyline After It Is Already Drawn

Sub MoveCoordinatesPolylineAfterAlreadyDrawn() Dim VFG(7) As Double Dim retCoord(0 To 1) As Double Set acadApp = GetObject(, "AutoCAD.Application") Set acadDoc = acadApp.ActiveDocument Set objss = acadDoc.SelectionSets.Add("ToErase") objss.Select acSelectionSetAll objss.Erase objss.Delete VFG(0) = 0: VFG(1) = 0 'vertex 1 VFG(2) = 0: VFG(3) = -5 'vertex 2 VFG(4) = 10: VFG(5) = -5 'vertex 3 VFG(6) =… Continue reading Move Coordinates of Polyline After It Is Already Drawn

3D AutoCAD

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

autocad

Veiwports with TranslateCoordinates and CHSPACE

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

excel

Run a Macro at a Specific Time

Sub ImportModules() Debug.Print "test" End Sub Private Sub Workbook_Open() Application.OnTime Now + TimeValue("00:00:01"), "domeprog.ThisWorkbook.ImportModules" End Sub The code above will run the macro called 'ImportModules' one second after the workbook is opened. If the macro is located in a class module or in ThisWorkbook class, then you will need to call out the library +… Continue reading Run a Macro at a Specific Time