Reply

Hole counting inside Draft

[ Edited ]

Hi all. I have a problem I hope somebody of you can solve. I want to make a small piece of software to change the text of a balloon connected to a hole, i a way that will be written "N holes M12" (for the case of a thread for example).I can access the balloon that the user is selecting in the draft, and maybe I understood well that GetTerminator is giving me the object that somehow is connected to the hole, but I cannot actually obtain really the correct object and so obatining all the informations I want.

Thanks in advance for any kind of help.

P.S.: I'm using VB.NET express 2010 and ST3

 

Posted by: Giancarlo
Post date: 4/29/2011 5:48:10 AM

1 REPLY

RE: Hole counting inside Draft

[ Edited ]

I want to post a sort of reply-update as I found half a solution that can be usefull for somebody (maybe). Finally I went throw GetTerminator to find the seDVCircle2d object that represents the draft representation of a hole. Then I found all the holes in the same view and I filtered and counted all the circles with the same diameter. That's all. It is not a good solution as I didn't get the real "hole feature" I wanted to obtain, but at least it seams to give enough good results.Hereafter some lines of code:

For Each Selected As Object In Draft.SelectSetIf Selected.Type = igBalloon ThenDim Balloon As SolidEdgeFrameworkSupport.Balloon = Selected

Dim objTerminator As Object = Nothing, x As Double, y As Double, z As Double, keyPoint As Boolean

Balloon.GetTerminator(objTerminator, x, y, z, keyPoint)If objTerminator IsNot Nothing ThenIf objTerminator.Type = igReference ThenIf objTerminator.Object.Type = seDVCircle2d ThenDim circle As Object = objTerminator.ObjectDim Count As Integer = 0For Each oneCircle As Object In circle.ModelMember.DVCircles2dIf oneCircle.Diameter = circle.Diameter ThenCount += 1End IfNext

If Count > 1 ThenBalloon.BalloonText = Count & " %DI%HS"End IfElseIf objTerminator.Object.Type = seDVArc2d ThenDim arc As Object = objTerminator.ObjectDim Count As Integer = 0For Each oneArc As Object In arc.ModelMember.DVArcs2dIf oneArc.Radius = arc.Radius ThenCount += 1End IfNext

If Count > 1 ThenBalloon.BalloonText = Count & " %TS"End IfEnd IfEnd IfEnd IfEnd IfNext

 

Posted by: Giancarlo
Post date: 6/27/2011 11:09:42 PM