Jump to content

Search the Community

Showing results for tags 'punches'.

  • 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

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. Hello, I have been trying to create a macro that would add a custom property to my sheet metal parts that would tell me the total number of piercings in the part (holes and punches). So far I have the punches to count correctly but I am having issues with the holes, as I am getting an error. Any ideas? Sub Piercings() 'Get the part doc and sheet metal component defn. No error handling: Dim oPartDocument As Inventor.PartDocument Set oPartDocument = ThisApplication.ActiveDocument Dim oSheetMetalComp As Inventor.SheetMetalComponentDefinition Set oSheetMetalComp = oPartDocument.ComponentDefinition 'Dim oHoles As Inventor.HoleTables 'Set oHoles = oPartDocument.ComponentDefinition 'Get the pierce count Dim iHoleCount As Integer 'iHoleCount = oHoles.Count Dim iPunchCount As Integer iPunchCount = oSheetMetalComp.FlatPattern.FlatPunchResults.Count Dim iPierceCount As Integer iPierceCount = iHoleCount + iPunchCount 'Get the custom property set Dim oCustomProps As Inventor.PropertySet Set oCustomProps = oPartDocument.PropertySets.Item("Inventor User Defined Properties") 'Define the name of the PIERCING count iproperty name: Dim sPiercePropName As String sPiercePropName = "PIERCINGS" 'See if we already have an iproperty for the PIERCING count Dim oPierceProp As Inventor.Property Dim oProp As Inventor.Property For Each oProp In oCustomProps If oProp.Name = sPiercePropName Then 'We already have an iproperty, we just need to write the new value Set oPierceProp = oProp oPierceProp.Value = iPierceCount Exit Sub End If Next oProp 'We don't have an iproperty, so we create it and set its value If oPierceProp Is Nothing Then Set oPierceProp = oCustomProps.Add(iPierceCount, sPiercePropName) End Sub
×
×
  • Create New...