Inventor General

Reply
Member
Posts: 5
Registered: ‎09-16-2012
Message 1 of 3 (472 Views)

VBA: Distinguish hole features from other circles in drawing, add centermarks

472 Views, 2 Replies
09-16-2012 08:28 AM

I'm attempting to use VBA to put center marks on each hole in my drawing.

So far I have the following code:

    Dim oIntent As GeometryIntent
    Dim oCenterOfPart As Centermark
    
    'Add center marks to base view
    For Each oCurve In oBaseView.DrawingCurves ' <- need to identify Hole Features
        If Not oCurve.CenterPoint Is Nothing Then
            If oCurve.CurveType = kCircleCurve Then 'CurveTypeEnum
                Set oIntent = oSheet.CreateGeometryIntent(oCurve)
                Set oCenterOfPart = oSheet.Centermarks.Add(oIntent, True, True)
            End If
        End If
    Next oCurve
    
    'Add center marks to top view
    For Each oCurve In oTopView.DrawingCurves ' <- need to identify Hole Features
        If Not oCurve.CenterPoint Is Nothing Then
            If oCurve.CurveType = kCircleCurve Then 'CurveTypeEnum
                Set oIntent = oSheet.CreateGeometryIntent(oCurve)
                Set oCenterOfPart = oSheet.Centermarks.Add(oIntent, True, True)
            End If
        End If
    Next oCurve
    
    'Add center marks to right view
    For Each oCurve In oRightView.DrawingCurves ' <- need to identify Hole Features
        If Not oCurve.CenterPoint Is Nothing Then
            If oCurve.CurveType = kCircleCurve Then 'CurveTypeEnum
                Set oIntent = oSheet.CreateGeometryIntent(oCurve)
                Set oCenterOfPart = oSheet.Centermarks.Add(oIntent, True, True)
            End If
        End If
    Next oCurve

  

oBaseView is the DrawingView object representing the base view the code just placed. I also used VBA to place the projected views oTopView and oRightView. I want to add center marks to each hole when viewed from the end (as circles) and add centerlines when viewed from the top or side (as hidden lines).

 

I will be iterating through several models representing various handhold styles. The feet can be in many orientations, 99% of them are paralel to one of the origin planes (XY,YZ, or XZ).

 

This is what my code generates:

Capture.PNG

 (The centermarks that are selected are the ones I don't want the code to generate)

 

 This is what I WANT the code to generate:

Capture2.PNG

 

 1) How do I distinguish whether a circle curve originated because of a hole or because of another cilindrical feature?

2) How to I identify the correspoding hidden lines in the other views so I can add a center line?

*Expert Elite*
mrattray
Posts: 2,241
Registered: ‎09-13-2011
Message 2 of 3 (438 Views)

Re: VBA: Distinguish hole features from other circles in drawing, add centermark

09-17-2012 05:20 AM in reply to: CragMonkey

I don't know that answer to your question, however these sort of questions usually get better answers in the customization forum.

Mike (not Matt) Rattray

Member
Posts: 5
Registered: ‎09-16-2012
Message 3 of 3 (434 Views)

Re: VBA: Distinguish hole features from other circles in drawing, add centermark

09-17-2012 05:46 AM in reply to: mrattray

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube