Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Linking many Dimensions to a single parameter

Status
Not open for further replies.

xcllyf

New member
Jul 1, 2013
19
0
0
I have a lot of dimensions in a single sketch, approx 120 dimensions. I have around 60 radial dimension in it. I want to link all the radius values to a single parameter. Instead of selecting the dimension individually and linking it to the parameters, is there any other option in catia where I can choose multiple dimension and link it to the parameter. I do not want to use equivalent dimension option. The problem gets even tougher with many similar sketches in the same catpart. Please suggest your ideas.
 
Replies continue below

Recommended for you

hi,
you can select all the radiis in the tree and right click ..go to select objects....equivalent dimensions...in the equivalent dimensions dialog box...right click in the value field...choose edit formula....now you can relate this to a single parameter.

<hope it helps >
 
better yet: do NOT put the fillets in the sketch. Add the fillets after the Pad (or pocket) as a solid feature, and then you will have one parameter driving all the fillets.
 
After re-reading the original post, my suggestion may not apply. Could you send us a picture of your sketch?

In many cases, it is better to keep sketch simple (no fillets), and use 3D featues later in the tree to add the fillets. Another example is duplicated shapes; do not mirror or draw the same shape within the sketch. Instead, use Symmetryr or Pattern to duplicate the shape.
 
This sounds like a job for some iterative code that does this:
1) Find all the "Length Constraints"
2) Loop through the results : looking for "Radius"
3) If radius is found, create the relation


Record your self doing one of them and look at the code.
This will show you how to assign the constraint to the parameter.

One way to see the code that selects all the "Length Constraint" is to record yourself doing a search for them using the Search tool.

Then add code that loops through the search results looking for the word "Radius" and creates the relation.
(assuming the constraints have the names something like "Radius.26")

 
Code:
Sub Link_Radius()

Set Document = CATIA.ActiveDocument

Dim oPart As Part
Set oPart = Document.Part

Dim oBody As Body
Set oBody = oPart.Bodies.Item("PartBody")

Dim oSketch As Sketch
Set oSketch = oBody.Sketches.Item("Sketch.1")

Dim oConstraints As Constraints
Set oConstraints = oSketch.Constraints
    icount = 0
For i = 1 To oConstraints.Count
    
Set Cst = oConstraints.Item(i)
    
If Cst.Type = catCstTypeRadius Then
Dim sName As String
sName = Cst.Name
  
  Dim Dime As Object
  Set Dime = Cst.Dimension
  
  Dim sParam As String
  sParam = Dime.Name
  
  Dim lValue As Double
  lValue = Dime.Value / 25.4
  icount = icount + 1
  Link_Parameter_to_Dimension sName, sParam, lValue, icount
Else
End If
  
Next i
    

End Sub

Function Link_Parameter_to_Dimension(sName As String, sParam As String, lValue As Double, ByVal icount As Integer)

Dim oPart As Part
Set oPart = CATIA.ActiveDocument.Part

Dim D1Name As Object
Set D1Name = oPart.FindObjectByName(sName)

Dim D1 As RealParam

If icount = 1 Then
Set D1 = oPart.Parameters.CreateReal("Radius", lValue)
Else

End If

Dim oRelations As Relations
Set oRelations = oPart.Relations

Dim Param As Parameters
Set Param = oPart.Parameters.SubList(D1Name, True)
 
Dim sBodyFormula As String

sBodyFormula = "(" & "Radius" & "*1in)"

Dim oFormula As Formula
Set oFormula = oRelations.CreateFormula("", "", Param.Item(1), sBodyFormula)

End Function

Link all sketch radius to single parameter.. just be careful with the value of the radius.
 
 http://files.engineering.com/getfile.aspx?folder=f21ce981-987a-456e-9827-1c1c2959cba0&file=Untitled.png
Status
Not open for further replies.
Back
Top