Reply

UserDefinedPatterns

[ Edited ]

 

I'm trying to create a user defined pattern for a profile consisting of two holes.  The code always bombs out on the last statement.  I believe there to be an array issue, but I'm not sure how to fix it.  any idea's?

 

Dim oProfile As SolidEdgePart.Profile = Nothing

Dim oProfileCollection As SolidEdgePart.Profiles = Nothing

Dim oProfiles(6) As SolidEdgePart.Profile

Dim oHole As SolidEdgePart.Hole = Nothing

Dim oHoleData As SolidEdgePart.HoleData = Nothing

Dim oUDpattern As SolidEdgePart.UserDefinedPattern = Nothing

 

 

oProfile = m_PartDoc.ProfileSets.Add.Profiles.Add(oRefPlane(0))

oProfile.Holes2d.Add(x(0), y(0))

oProfile.Holes2d.Add(x(1), y(1))

lngStatus = oProfile.End(igProfileClosed)

If lngStatus 0 Then

    MsgBox("Invalid Profile")

End If

oProfileCollection = oProfile.Parent.profiles

For i = 1 To oProfileCollection.Count

    oProfiles(i) = oProfileCollection.Item(i)

Next

oHoleData = m_PartDoc.HoleDataCollection.Add(HoleType:=igRegularHole, HoleDiameter:=dHoleDiameter * SE, _

                                        TreatmentType:=igTappedHole, ThreadDescription:=m_sTapSize, _

                    ThreadDepth:=m_oBushing.TappedHoleDepth * SE)

oHole = m_PartDoc.Models.Item(1).Holes.AddFinite(oProfileCollection.Item(1), igLeft, m_dLTB * SE, oHoleData)

oUDpattern = m_PartDoc.Models.Item(1).UserDefinedPatterns.AddByProfiles(i, aProfiles, oHole)

 

Posted by: Bob Reinkemeyer
Post date: 2/11/2009 3:59:37 AM

3 REPLIES

RE: UserDefinedPatterns

[ Edited ]

 

I took the working VB6 code and upgraged to .net.  this is the warning I recieved from the above code.

UPGRADE_WARNING: Couldn't resolve default property of object objProf.Parent.Profiles

Appearenty default properties aren't allowed in .net.  Any idea how to get around this one?

 

 

Posted by: Bob Reinkemeyer
Post date: 2/13/2009 2:18:42 AM

RE: UserDefinedPatterns

[ Edited ]

 

I have just had a problem with UserDefinedPatterns.

 

I had this line in C++:

PatternsPtr spPatterns = m_model->GetUserDefinedPatterns();

 

Untill the last SolidEdge version it worked fine but for the current version (100), it returns NULL.

So I had to protect the code after this line with

if (spPatterns != NULL)

 

Maybe your problem is that your "m_PartDoc.Models.Item(1).UserDefinedPatterns" is NULL too?

 

Adar

 

Posted by: Adar Shtainhart
Post date: 3/9/2009 12:37:05 AM

RE: UserDefinedPatterns

[ Edited ]

 

Thanks Adar, I'll give that one a try today.

 

Posted by: Bob Reinkemeyer
Post date: 3/9/2009 1:48:07 AM