Hello together,
is there a way to delete the bolted connections and keep the parts which are inserted with the bolted connection with VB.NET?
How could I explode the holes (make them independent) in plates?
https://forums.autodesk.com/t5/inventor-forum/make-hole-through-several-plates/td-p/2973292
Thank you
Georg
Solved! Go to Solution.
Solved by wayne.brill. Go to Solution.
Hello Georg,
There is not any API for bolted connections. Also there is not any direct method in the API to do what the explode command does to the ClientFeature using the UI to allow the hole to be converted to a HoleFeature.
It seems like it should be possible to use the API to get the HoleFeature from the ClientFeatureElements of the ClientFeatureDefinition. Once your code gets the HoleFeature created you could delete the ClientFeature. I do not have code that does this and I am not sure how doing this would interact with the bolted connection.
You can use Inventor VBA and the watch window to see the properties of the ClientFeature. Here is a snippet that you can use. Put a break point on End Sub and add a watch for oObj. (have the hole selected in the part before running the code). You will also find attributes that are used by the bolted connection.
Public Sub SelectTest()
Dim oDoc As Document ' DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
If oDoc.SelectSet.count > 0 Then
Dim oObj As Object
Set oObj = oDoc.SelectSet(1)
End If
End Sub
If you want an API to delete the bolted connections and keep the parts which are inserted with the bolted connection and the holes in the parts please post it on the Inventor idea station.
http://forums.autodesk.com/t5/inventor-ideastation/idb-p/v1232/tab/most-recent
Thanks,
Wayne
Hello Wayne,
is it possible to ask the developper how to change the hole (explode it)? That would be very helpful.
Georg
Hi Georg,
A colleague has this suggestion:
>> >>
The users want to delete bolt connection and keep the holes through Inventor API. Please correct me if I am wrong.
From my side, we just need delete the bolt connection by API. Actually, Bolt Connection is a ComponentOccurrence object from viewpoint of API. Below is sample code.
Dim oCompOcc As ComponentOccurrence
Set oCompOcc = oAssyDoc.ComponentDefinition.Occurrences.Item(3)
Call oCompOcc.Delete
<< <<
I used similar code and I see the bolted connection is deleted and the holes remain in the part. To test this just have the bolted connected selected.
Public Sub SelectTest() Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument If oDoc.SelectSet.count > 0 Then Dim oObj As Object Set oObj = oDoc.SelectSet(1) Dim oCmpOcc As ComponentOccurrence Set oCmpOcc = oObj Call oCmpOcc.Delete End If End Sub
I do notice that after the bolted connection ComponentOccurrence is deleted by API the hole in the part has attributes that seem to be related to bolted connection. I believe your code could safely delete these attributes as well.
Thanks,
Wayne
Hello Wayne,
this is a workaround but does not solve the problem.
Thank you.
Georg
Hi Georg,
After the component occurrence for the bolted connection is deleted the holes in the parts are ClientFeatures. The code below will do something similar to exploding the client feature using the UI. (thanks to a colleague for providing it)
Notice the ClientFeatureDefinition.ClientFeatureElements.Item(index).Delete is used to delete the element to release the native object(Hole feature in the case). Then the ClientFeature is deleted.
Sub ExplodeClientFeature() Dim oPartDoc As PartDocument Set oPartDoc = ThisApplication.ActiveDocument 'get client feature Dim oCF As ClientFeature Set oCF = oPartDoc.ComponentDefinition.Features.ClientFeatures.Item(1) 'delete elements in client feature Dim oCFElements As ClientFeatureElements Set oCFElements = oCF.Definition.ClientFeatureElements Dim nCount As Integer nCount = oCFElements.count Dim i As Integer For i = nCount To 1 Step -1 Call oCFElements.Item(i).Delete Next 'delete client feature Call oCF.Delete End Sub
Thanks,
Wayne