Not Letting me make multiple constraints to a part

Not Letting me make multiple constraints to a part

marcus_bGN4VF
Observer Observer
205 Views
1 Reply
Message 1 of 2

Not Letting me make multiple constraints to a part

marcus_bGN4VF
Observer
Observer

Hi,

 

I have been making an ilogic that automatically adds custom bars into a frame. i have managed to get each constraint to work on their own however when I un comment the second or third constraint then i get an error saying the Parameter is incorrect even though i know it isn't.

 

Has anyone else had this problem before? 

 

it only seems to happen to certain parts as earlier in the same code i have a version with a contents just the standard bar and i can constrain that as much as i want (without over constraining obviously). 

 

	StandardOccurrence = oAsmDoc2.ComponentDefinition.Occurrences.Add(StandardBarFile, ThisApplication.TransientGeometry.CreateMatrix())
	StandardBar = StandardOccurrence.SurfaceBodies.Item(1)
	FaceCount_StandardBar = StandardBar.Faces.Count
	Dim StandardBarTopFace As Face = StandardBar.Faces(FaceCount_StandardBar)
	Dim StandardBarSideFace1 As Face = StandardBar.Faces(7)
	Dim StandardBarSideFace2 As Face = StandardBar.Faces(15)
	Dim StandardBarFrontFace As Face = StandardBar.Faces(13)
	
	Dim oPartDoc As PartDocument = SR2BarOccurrence.Definition.Document
	

	Dim Number As Double = 1
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap1") = worksheet.Range("D9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap2") = worksheet.Range("E9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap3") = worksheet.Range("F9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap4") = worksheet.Range("G9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap5") = worksheet.Range("H9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap6") = worksheet.Range("I9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap7") = worksheet.Range("J9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap8") = worksheet.Range("K9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap9") = worksheet.Range("L9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Gap10") = worksheet.Range("M9").Value
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "B_L") = Height_Gap
	Parameter("5634 - SR2 Bar Infill For Generator:" & Number, "Top_Gap") = worksheet.Range("O9").Value

	
	SR2Bar = SR2BarOccurrence.SurfaceBodies.Item(1)
	FaceCount_SR2Bar = SR2Bar.Faces.Count
	Dim SR2BarTopFace As Face = SR2Bar.Faces(FaceCount_SR2Bar)
	Dim SR2BarBottomFace As Face = SR2Bar.Faces(FaceCount_SR2Bar - 1)
	Dim SR2BarFrontFace As Face = SR2Bar.Faces(FaceCount_SR2Bar - 13)
	Dim SR2BarSideFace1 As Face = SR2Bar.Faces(FaceCount_SR2Bar - 11)
	Dim SR2BarSideFace2 As Face = SR2Bar.Faces(FaceCount_SR2Bar - 11)
	
	Dim oConstraint1 As MateConstraint = oAsmDoc2.ComponentDefinition.Constraints.AddMateConstraint(SR2BarSideFace2, SideFace1, 10)
	Dim oConstraint2 As MateConstraint = oAsmDoc2.ComponentDefinition.Constraints.AddMateConstraint(SR2BarTopFace, TopFace, 0)	
	Dim oConstraint3 As FlushConstraint = oAsmDoc2.ComponentDefinition.Constraints.AddFlushConstraint(SR2BarFrontFace, OuterFace, 0)	
	

 

0 Likes
Accepted solutions (1)
206 Views
1 Reply
Reply (1)