Jump to content

Search the Community

Showing results for tags 'vba'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 57 results

  1. Anyone has a code to accomplish this? I am dealing with bunch of poorly converted lines from PDF that used to be AutoCAD text in the drawing. Greatly appreciated!
  2. Hello Anybody Help. I need to get point from spline with use lisp function in autocad vba vlax-curve-getPointAtDist Could somebody can help me? Best Regard Joe
  3. Hi to all, please somebody know how to manage the ampoweredit functionality and related dialog windows by VBA personalizzation ?
  4. Hi, I'm new to AutoCAD. I have 700 drawings in AutoCAD. I have to enter "Checker" value in the drawing title block. For all the drawings, its the same value. How to I automate this? I don't want to open manually individual drawing and fill the value. Any macro available for this? Please help. Regards, Prasanna.A
  5. Hello, I am trying to create a dimension style using VBA Excel. I have a simple code as follows: Option Explicit Sub New_Layer() Dim acadApp As AcadApplication Dim acadDoc As AcadDocument Dim mSp As AcadModelSpace Dim dimstyle As AcadDimStyle Dim sDim As AcadDimAligned Dim point1(0 To 2) As Double Dim point2(0 To 2) As Double Dim location(0 To 2) As Double 'Check if AutoCAD is open. On Error Resume Next Set acadApp = GetObject(, "AutoCAD.Application") On Error GoTo 0 'If AutoCAD is not opened create a new instance and make it visible. If acadApp Is Nothing Then Set acadApp = New AcadApplication acadApp.Visible = True End If 'Check if there is an active drawing. On Error Resume Next Set acadDoc = acadApp.ActiveDocument On Error GoTo 0 'No active drawing found. Create a new one. If acadDoc Is Nothing Then Set acadDoc = acadApp.Documents.Add acadApp.Visible = True End If Set mSp = acadDoc.ModelSpace 'Dimension points point1(0) = 0#: point1(1) = 5#: point1(2) = 0# point2(0) = 6.1: point2(1) = 5: point2(2) = 0# location(0) = 5#: location(1) = 4.4: location(2) = 0# 'Add dimension Set sDim = acadDoc.ModelSpace.AddDimAligned(point1, point2, location) 'Set dimension properties sDim.Color = acByLayer sDim.ExtensionLineExtend = 0 sDim.Arrowhead1Type = acArrowOblique sDim.Arrowhead2Type = acArrowOblique sDim.ArrowheadSize = 0.1 sDim.TextColor = acGreen sDim.TextHeight = 0.2 sDim.UnitsFormat = acDimLDecimal sDim.PrimaryUnitsPrecision = acDimPrecisionOne sDim.TextGap = 0.1 sDim.LinearScaleFactor = 100 sDim.ExtensionLineOffset = 0.1 sDim.VerticalTextPosition = acOutside 'Create a new dimension style Set dimstyle = acadDoc.DimStyles.Add("D100") 'Copy dimension properties from previously added dimension dimstyle.CopyFrom (sDim) 'Delete dimension sDim.Delete End Sub However dimstyle.CopyFrom (sDim) line does not working. I am getting following error: "Object doesn't support this propert or method" I couldn't find what I am doing wrong. I am using AutoCAD 2013 and Excel 2016. Thank you!
  6. selvamani

    Printing Customization

    Hi All, I need help in customizing printing cad files actually in my case single drawing would have multiple sheets in single model space so it will have multiple title block is there any way to print entire region inside title block one by one by means of vba scripting? (i mean is there any way to sense outer boundary of title block in vb and set it as printing area) Having thousands of cad files in which work area in model space of any two drawing is not same thanks in advance Drawing2.dwg
  7. My VBA application requires info from one drawing to be used in another one in the same VBA running session. I need to ALIGN one drawing based upon 3 3D points from another draiwng automatically. At the moment I'm running my application to collate the info from drawing 1, store it, close my application to open the other drawing and run my application again to retrieve the info to ALIGN it. Any idea how I can switch to another loaded drawing in the same VBA running session? Thanks!
  8. Is it possible to exclude from a vba macro for Autocad a specific region? For example, apply this macro not to all modelspace but only to a part (which has not lines as boundaries but defined only by position reference x,y in autocad). Thanks
  9. ElCidCampeador

    VBA Autocad: How to find lines?

    I'm trying to write a VBA code that searches in a general drawing all lines that have a specific length and slope. Then, every time it finds that line in the drawing, it will write next to a specific text, for example "line". Do you think it's possibile? Any idea? Thanks
  10. ElCidCampeador

    Recognize multi-object shape

    Hi, I converted a pdf file into dwg. In this new file a point has become a group of 2D polyline and not a sigle entity. This conversion is necessary because I have to work in autocad. My problem is that I have to search in this dwg all of this "points" and write a text next to. Is possible to write a VBA program for autocad able to do this? If the point was a single point, it wouldn't be a problem, but in this case...I dont' know!
  11. Hi First time poster here. I've only got AutoCAD13 and there's almost no chance for us to get civil 3d. But I have a 4km pipeline i'm trying to model so I'll need a longsection. Besides doing it manually is there a more efficient method, given the contour file I have is at 0.5m intervals. I'm thinking even a script in Excel that pulls the intersect for the pipeline polyline and contour lines and return the x-y-z coordinates. Thanks
  12. Hi everybody, I have a big problem.... I have about 100 DWG with a lot of sheet in the same model space and i must print every sheet, so i am looking for a script in VBA or lisp to create from multiple areas to plot in model space, a layout tab for each area vba autocad. I found a lisp script, but it doesn't run (plotDWGarr). (http://www.cadforum.cz/cadforum_en/plotting-a-series-of-drawing-frames-composed-in-a-dwg-drawing-tip7585) Do you know another similar script o to write a VBA to do it? Thank you very much in advance
  13. Hi Everybody, Via the command area it is possible to retrieve the surface area of a solid body (Acad3DSolid). Unfortunately the area it is not a property of a solid body so I'm haveing difficulties retrieving the surface area (which I want to write to an excel file). I've tried to explode the solid which results in several regions and surfaces. Unfortunately only the regions have an area; the (curved) surfaces don't. Anybody suggestions how to get the area of some solids useing VBA? Looking forward to the suggestions!
  14. I met a very "strange" behavior of VBA with Fillet Command send via ThisDrawing.SendCommand function. I have the function Fillet_2Line (line1, line2, r), which will apply the Fillet command to line1, line2 with Radius=R Sub fillet_2line(line1 As Variant, line2 As Variant, radius As Double) Dim text As String text = "f" & vbCr & "r" & vbCr & radius & vbCr & "(handent " & Chr(34) & line1.Handle & Chr(34) & ")" & vbCr & "(handent " & Chr(34) & line2.Handle & Chr(34) & ")" & vbCr ThisDrawing.SendCommand (text) End Sub As you can see, the function is very simple, call Fillet command from Autocad then select two lines by their handle. Use can reproduce the function without VBA by call Fillet command and select two POLILINES by their HANDLE. However, it works on LINE, but NOT POLYLINE. If I select two polylines by left click on them, it works. But if I select two polylines by their HANDLE, it does not work! Fillet 2 Line - Selected by left click - Works Fillet 2 Line - Selected by handle - Works Fillet 2 PLine - Selected left click - Works Fillet 2 PLine - Selected by handle - Does not work
  15. Hello, I'm a new user about autocad and new user about this Forum. I try use VB and CAD... Is there a solution for my problem in object? i just write code for MSGBOX: Dim Variabile As Integer Variabile = MsgBox("Hai esportato i parametri?", vbOKCancel) If Variabile = 2 Then ActiveWindow.Close and work if use a macro....but for insert this message when close a file? can i make a particular macro for this like excel or access??? thanks for You interest
  16. Hi There Sorry that this will be such a basic question. I am not a VBA expert in any way....quite new actually . Running Autocad Architecure 2014. I have a VBA utility that I have made a special button for. I want this button to insert a dynamic block. I have WBLOCK'ed the block and it is in a nework folder - no issues here. There are several other snippets of VBA code that I have found online (even from this forum) and have tried to modify them to work. I must be doing something wrong, as it always stumbles within the code or silently sits there doing nothing. I just want to click this button and my dynamic block (from network) will be brought into the existing drawing, and the user will select insert point and direction..... Mouse click...done....block inserted. Similar action to a block that would be brought from a tool pallette (but has to be from this VBA utility) Any help would be appreciated. Matt
  17. Hi Everyone I know this and similar questions have already been posted in many forums, and before you start copy pasting links of other threads, you have to know that I probably have seen them already and none of them is 100% perfect answer to what I am trying to achieve. And now I will describe my situation and my issue. I am a REVIT guy but I recently started a new job in an office that uses primarily Autocad. I am currently in the process of creating office standards. The problem is that it does not happen over night. At the moment I am mainly relying on (dynamic) blocks. As I keep creating them, I save them in a template file - let's call it "XYZ". We currently have 40-50 active projects. Some new, some old. When I myself am working on a project - what I do is "copy/paste" all the blocks from the XYZ file so i can use them in the currently open project. The problem is that my colleagues are either stupid enough not to know or remember (how) to "copy/paste" the blocks or are just so lazy that can not be bothered (completely unpleasant environment). So what I want to achieve is: whenever someone opens an Autocad drawing, to have all the blocks from the "XYZ" file already loaded. Or alternatively have all the WBLOCK files loaded from a specific directory like c:\Autocad\abcd... Bear in mind that this is not 1 time thing that needs to be performed on all the active project drawings. I keep creating new blocks every day. Please do not respond with "This can be achieved by....". I am looking for a way not to have anyone do anything, but Autocad do all the work. I would much rather be satisfied with "This cannot be achieved" answer, rather than having people enter JUST a few commands to get it done. My colleagues are stupid and they won't press an extra key to get the blocks loaded. I would be really grateful if anyone can help me. If not, nothing changes, I have already lost faith...
  18. Hi, I need to extract Information ("General": Color, etc. and "Geometry": Length, Start Y, End X, etc.") from AutoCAD to an Excel-Sheet using VBA. First I've tried it manually in AutoCAD with the commands DATAEXTRACTION and EATTTEXT and it works. Also I've tried entering in VBA "SendCommand ("DATAEXTRACTION" & vbCr")", then an AutoCAD-window is opened and I have to click on "Next" several times and to specify the folder where I want to save the file. I want that VBA does all this process without the window appearing (I mean "without clicking on "Next" several times and specifying the file path"). Obvious the User has to Input into the code the location where he wants to save the file with the extracted information). Instructions als "For Each Object in ModelSpace: Line.StartPoint, Line.Color, etc." don't help me unfortunately because this way slow down the VBA-program. May anyone help me? Thanks! Regards,
  19. hello evryone , i'm looking to make a VBA code to get a setected coordinate point (x,y and Z) directly to excel sheet . thank you for your help
  20. Hi! I would like a macro which will add a text attribute from an x-ref file to another block attribute which is up to 1.5m around the x-ref element. example: Attribute block: WF-PC-L2.0-095 X-REF attribute: L2.0-0368 I' d like to add L2.0-0368 to WF-PC-L2.0-095. The distance between the 2 attributes is no more than 1.5m perimetrically. I guess coordinates can be the common reference, but i am not faamiliar with coding..
  21. Hi, iv got the below vba in progress, i copied it from somewhere online but cannot remember where to give credit Anyway iv got it running from a userform but it will only update the last block inserted. Eventually i want to use it to control 5+ dynamic block, also with visibility states but im at a loss after trying multiple things over the last few hours. Can someone point me in the right direction please? Public Sub block_dyn() Dim objBlock As AcadBlockReference 8 Dim FilterType(0) As Integer Dim FilterData(0) As Variant Dim p1(0 To 2) As Double Dim p2(0 To 2) As Double Dim ssetObj As AcadSelectionSet On Error Resume Next ThisDrawing.SelectionSets.Item("SS1").Delete Set ssetObj = ThisDrawing.SelectionSets.Add("SS1") FilterType(0) = 0 FilterData(0) = "" ssetObj.Select acSelectionSetAll, p1, p2, FilterType, FilterData For Each Item In ssetObj If objBlock.EffectiveName = "Box" Then Set objBlock = ssetObj.Item(n) Call dyn_prop(objBlock, "Width", TextBox3.Value) Call dyn_prop(objBlock, "Height", TextBox4.Value) End If If objBlock.EffectiveName = "Rect" Then Call dyn_prop(objBlock, "Thickness", TextBox3.Value) Call dyn_prop(objBlock, "Depth", TextBox4.Value) End If Next End Sub Public Sub dyn_prop(objBlock As AcadBlockReference, name_of_property As String, value_of_property As Double) Dim dyn_properties() As AcadDynamicBlockReferenceProperty Dim var_atts As Variant var_atts = objBlock.GetDynamicBlockProperties For i = LBound(var_atts) To UBound(var_atts) If var_atts(i).PropertyName = name_of_property Then var_atts(i).Value = value_of_property ThisDrawing.SendCommand "_regen" & vbCr End If Next End Sub Thanks in advance ~D
  22. Hi everyone, Ive made a tool to cleanup your dwg-drawings: CLEAN UP XREF V1.1 I want to share it, to help each other! Send me your comment! You can download it below. It contains the follow functions: '************************************************************************ '--- SET_UP_DRAWING --- '1 UCS_WORLD '1 PLANVIEW_UCSWORLD '2 SET_UP_VARIABLES '2 SET_UP_UNITS '3 SCALE_DRAWING '4 LTSCALE_ALL_EXCLUDE_BLOCKS (30) 'WAARDE VAN LTSCALE MEEGEVEN '5 LTSCALE_ALL_BLOCKS (15) 'WAARDE VAN LTSCALE MEEGEVEN '6 FLATTEN_DRAWING '--- SET_UP_LAYERS --- '7 STORE_LAYERSTATE '8 RESTORE_LAYERSTATE '9 SET_LAYER_XREF_TEMP_CURRENT '10 ALL_LAYERS_ON '11 UNLOCK_ALL_LAYERS '12 UNFREEZE_ALL_LAYERS '13 LAYERS_LINEWEIGHT_DEFAULT '14 REMOVE_LAYER_FILTERS '--- CLEANING_STUFF --- '15 PURGE_DRAWING '16 AUDIT_MODELSPACE '17 DELETE_LAYOUTS '18 DELETE_VIEWPORTS '19 DELETE_VIEWS '20 DELETE_DIMENSIONS '21 CLEAN_SCALELIST '--- LAYER_STUFF --- '22 CLEAR_LAYER0 ' DELETE_LAYER ("E-61-ELEKTRISCHE BORDEN") 'HIER DIEN JE NAAM VAN LAYER IN TE VULLEN '23 DELETE_FROZEN_LAYERS '24 ALL_BY_LAYER1 '25 ALL_BY_LAYER2 '--- BLOCKS_STUFF --- '26 ALL_BLOCKS_BY_LAYER '27 BURST_EXPLODE_BLOCKS '28 BURST_EXPLODE_DRAWING_DOWN (3) '29 FIX_BLOCK '--- XREF_STUFF --- '30 TRY_TO_RELOAD_ALL_XREFS_UNLOADED '31 TRY_TO_DETACH_ALL_XREFS_UNLOADED '32 BIND_AND_EXPLODE_ALL_XREFS_LOADED '33 DELETE_UNLOADED_IMAGES '--- EXPORT_STUFF --- '34 CREATE_BACKUP_FILE ' SAVE_AS_XREF ' CREATE_WBLOCK '35 COPY_INTO_TEMPLATE '************************************************************************ Help each other to be helped! CLEAN_UP_XREFSv1.1.zip
  23. Hey guys, Just curious and looking for suggestions, but like the title says, what kind of automation or macros do you guys like to run in your Inventor? For example, we tend to have to send pdf's of part prints instead of actual Inventor or CAD formats to manufacturers for release or what not. So, in the drawing template there is a rule that runs and creates (if one doesn't exist) or resaves (if it does exist) a pdf file every time you save. And as always, I like to hit save a bunch so I lose as little info as possible if my computer crashes or Inventor does. As long as you have the option to not preview the file after it is exported/saved, it doesn't slow your saving down too much. Other than that really, I don't have much else. I've thought of a few I might like to add or research how to do myself through macros and VBA, but can't seem to find the down time to work on it much. Any other little tools/add-ons you like to run with your Inventor?
  24. Ramesh PK

    Drawing cylinders

    I use AutoCAD 2007 and program in VBA. Could you help with drawing cylinders in VBA. The "AddCylinder" draws only in WCS meaning I get cylinders in only one direction. I need cylinders to the UCS I set using the VBA program.
  25. guusdehart

    vba drawing polyline

    Hi, My VBA project reads coordinate file from field measurements of topographer and builds via some routines two classes: AllPoints (x,y) and AllLines (from x,y , to x,y). Seperating real points from reference points. I cannot seem to get a way to kick of the drawing command. Anybody some ideas? Preferebly a polyline with closed option. Thanx!
×