Parameters for Threads.Add Method

Legend
Legend

Hello altogether,

i want to add a thread feature to a face. I added the holeData of the thread to the holeDataCollection, selected the face (the cylinder of a counterbore) and selected one edge of that face.

 

What does the threads.add method want as parameter for CylinderEndArray?

 

I converted the cylindrical face of the counterbore to a cylinder, but i don't know what i should use for the CylinderEndArray. I tried many things, but nothing works. The SDK is not very clear at this point and i coudn't find anything in the examples on GitHub.

 

Can anybody provide a little example?

 

Greetings from Germany
Christian Kunkel
https://c-k-m.info
4 REPLIES

Re: Parameters for Threads.Add Method

Phenom
Phenom

Hi Christian:

 

I tried to pass the circular edge of the cylindrical face wrapped in an object array for the CylinderEndArray but the following is not working:

 

        Dim seApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application")
        Dim sePart As SolidEdgePart.PartDocument = seApp.ActiveDocument
        Dim seModel As Model = sePart.Models(0)
        Dim seBody As Body = seModel.Body
        Dim seFaces As Faces = seBody.Faces(FeatureTopologyQueryTypeConstants.igQueryCylinder)
        Dim seFace As Face = seFaces.Item(0)

        Dim seEdges As Edges = seFace.Edges()
        Dim seEdge As Edge = seEdges(0)

        Dim seHoledata As HoleData = sePart.HoleDataCollection.Add(SolidEdgePart.FeaturePropertyConstants.igRegularHole, 0.02, , , , , , , , , , , , , , 149, , , , "M20")

        seHoledata.ThreadDiameterOption = 2
        seHoledata.Standard = "ISO Metric"
        seHoledata.Size = "M20"
        seHoledata.Fit = ""
        seHoledata.ThreadSetting = SolidEdgePart.FeaturePropertyConstants.igRegularThread
        seHoledata.TreatmentType = SolidEdgePart.FeaturePropertyConstants.igTappedHole
        seHoledata.ThreadDataByDescription = "M20"
        seHoledata.ThreadDepth = 0.0022
        seHoledata.ThreadDepthMethod = 13
        seHoledata.ThreadSetting = 164
        seHoledata.ThreadNominalDiameter = 0.02

        Dim seCylinderArray(0) As Object
        seCylinderArray(0) = seFace

        Dim seCylinderEndArray(0) As Object
        seCylinderEndArray(0) = seEdge

        seModel.Threads.Add(seHoledata, 1, seCylinderArray, seCylinderEndArray)

 

I can show code to add a threaded hole instead. Would that be useful ?

  

Regards,

~Tushar

 

Re: Parameters for Threads.Add Method

Phenom
Phenom

I read in the SDK documentation now that the CylinderEndArray is 
"An array of faces that correspond to each of the arrays specified in the CylinderArray argument. Each array specifies the end of the cylinder at which the thread is to start."

 

So I modified the array to include the circular planar end faces of the cylinder, though it is still not working:

 

 Dim seApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application")
Dim sePart As SolidEdgePart.PartDocument = seApp.ActiveDocument
Dim seModel As Model = sePart.Models(0)
Dim seBody As Body = seModel.Body
Dim seFaces As Faces = seBody.Faces(FeatureTopologyQueryTypeConstants.igQueryCylinder)
Dim seFace As Face = seFaces.Item(0)

Dim seEFaces As Faces = seBody.Faces(FeatureTopologyQueryTypeConstants.igQueryPlane)
Dim seEFace1 As Face = seEFaces(0)

Dim seHoledata As HoleData = sePart.HoleDataCollection.Add(SolidEdgePart.FeaturePropertyConstants.igRegularHole, 0.02, , , , , , , , , , , , , , 149, , , , "M20")

seHoledata.ThreadDiameterOption = 2
seHoledata.Standard = "ISO Metric"
seHoledata.Size = "M20"
seHoledata.Fit = ""
seHoledata.ThreadSetting = SolidEdgePart.FeaturePropertyConstants.igRegularThread
seHoledata.TreatmentType = SolidEdgePart.FeaturePropertyConstants.igTappedHole
seHoledata.ThreadDataByDescription = "M20"
seHoledata.ThreadDepth = 0.0022
seHoledata.ThreadDepthMethod = 13
seHoledata.ThreadSetting = 164
seHoledata.ThreadNominalDiameter = 0.02

Dim seCylinderArray(0) As Object
seCylinderArray(0) = seFace

Dim seCylinderEndArray(0) As Object
seCylinderEndArray(0) = seEFace1

seModel.Threads.Add(seHoledata, 1, seCylinderArray, seCylinderEndArray)

Re: Parameters for Threads.Add Method

Legend
Legend

Hello Tushar,

 

thank's for your reply. That's the same i noticed. Threaded holes are no problem, but i can't add a thread feature. I tried many combinations for the cylinder array and the cylinder end array, but nothing works.

I tried the face of the cylinder and a cylinder object created from this face for the cylinder array in combination with edge, face and plane objects for the cylinder end array, but nothing works. I always receive an argument exception. I tried to investigate the error object, but i wasn't able to find out, which argument is wrong.

My holedata seems to be correct, because if i create a thread manually und change the holedata of this thread to my holedata, everything is still ok. There must be something wrong with the cylinder array or the cylinder end array. I guess it's the cylinder end array, which causes the problems.

At the moment, i don't know what else i could try.

Perhaps @jnewell can add an example on GitHub, how the threads.add method is working. This would be very helpful.

 

Greetings from Germany
Christian Kunkel
https://c-k-m.info

Re: Parameters for Threads.Add Method

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hallo Christian,

 

I also tried this in C++ with all combinations of SAFEARRAYs of VARIANT, SAFEARRAYs of IDISPATCH, VARIANT of SAFEARRAY of ...

NOTHING WORKED!

You should file an Incident Report, requesting a fix of that problem and an update of the documentation with some sample code!

Like Tushar said, creating a threaded hole is NO problem, but assigning a thread to an existing hole or cutout is!