How to apply tapped hole diameter change in document settings to entire sub-units in an assembly with Ilogic

How to apply tapped hole diameter change in document settings to entire sub-units in an assembly with Ilogic

htkim43EPL
Explorer Explorer
452 Views
4 Replies
Message 1 of 5

How to apply tapped hole diameter change in document settings to entire sub-units in an assembly with Ilogic

htkim43EPL
Explorer
Explorer

hello?
Ilogic inquires about how to apply the tapped hole diameter change in document settings to the entire sub-unit in an assembly in Ilogic.
The code below is a setting for single-unit modeling, but I'm curious about how to apply it to the entire sub-unit in an assembly.

1.png

0 Likes
453 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @htkim43EPL. I suppose that if you wanted to push this same setting to every other document that is referenced within the main assembly, you could use something like the following iLogic example, which iterates through each referenced document in the main assemblies 'AllReferencedDocuments' which extends to every level of the assembly. You could give this a try, and see if it does what you want.

If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
	MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
	Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oRefDocs As DocumentsEnumerator = oADoc.AllReferencedDocuments
For Each oRefDoc As Document In oRefDocs
	Dim oMSettings As ModelingSettings = Nothing
	If oRefDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
		Dim oRefADoc As AssemblyDocument = oRefDoc
		oMSettings = oRefADoc.ModelingSettings
	ElseIf oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		Dim oRefPDoc As PartDocument = oRefDoc
		oMSettings = oRefPDoc.ModelingSettings
	End If
	If IsNothing(oMSettings) Then Continue For
	If oMSettings.TappedHoleDiameter <> ModelDiameterFromThreadEnum.kThreadTapDrillDiameter Then
		Try
			oMSettings.TappedHoleDiameter = ModelDiameterFromThreadEnum.kThreadTapDrillDiameter
		Catch
		End Try
	End If
	If oRefDoc.RequiresUpdate Then oRefDoc.Update2(True)
Next
If oADoc.RequiresUpdate Then oADoc.Update2(True)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

htkim43EPL
Explorer
Explorer

hello? @WCrihfield
Thank you for your interest.
I applied it as the method you informed, but the specifications of the tap hole diameter only apply as the tap drill.
I hope to change freely with other conditions.

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Hi @htkim43EPL.  I do not fully understand what you are wanting the code to do then.  Please explain in much more detail what all you want the code to be able to do, and in what order you want those things done.  What are the 'conditions' you mentioned, and how should the code react to each condition?  Also, if you need for the code to prompt the user for input of some sort, at some point, or at multiple places, please indicate what the prompt should ask for (or say), when it should prompt the user, and what should happen in response to the prompt(s).  This setting only controls the physical, measurable diameter of holes that were created with a hole feature that is threaded, in relation to the thread specification.  If you want to change thread specifications, instead of just relative physical hole size, then we would need completely different, and more complicated coding to accomplish that.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

triox
Explorer
Explorer

Perfect, that's was what I was looking for. Thank you so much

0 Likes