Constrain Drawing Sheet Dimensions

Constrain Drawing Sheet Dimensions

Anonymous
Not applicable
704 Views
3 Replies
Message 1 of 4

Constrain Drawing Sheet Dimensions

Anonymous
Not applicable

Hi,

 

We are in the process of trying to automate the generation of drawing packs for manufacturing at our company. To do this we have created models and drawing sheets that get updated through the Inventor API. This all works fine except that when a parts size changes the dimension layout for that part in the .idw goes wrong. 

 

For example if you dimension a sketch in the model that dimesnion remains locked to the relative postion you placed it on the outside of the shape. When in the drawing sheet though, If you were to dimension a circle and have the note sitting on the outside, if you then go double the circle size in the model the dimension stays locked where it was placed and doesnt stay in its relative position as it does in the sketch of the model.

 

Please can somebody help with a solution to this problem?

 

Thanks

0 Likes
Accepted solutions (1)
705 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Here are some pictures of the problem. 

 

We need it to adjust the dimesion as in sketch mode of the model.

 

Thanks

0 Likes
Message 3 of 4

RodrigoEiras
Advocate
Advocate
Accepted solution

Hi Kurt,

 

I think what you would have to do is to arrange dimensions after the size of the part has changed. Unfortunately automatic arranging does not always give the desired result. 

In some cases you may want to "mark" some dimensions with an attribute to avoid them to be automatically arranged.

 

I paste below the code I use for that.

 

    Dim oDoc As DrawingDocument
    oDoc = ThisApplication.ActiveDocument

    Dim oSheet As Sheet
    oSheet = oDoc.ActiveSheet

    Dim oDrawingDimension As DrawingDimension
	Dim oDrawingDimensions As DrawingDimensions
	Dim oDimsToBeArranged As ObjectCollection
	
	Dim iLinearDimCount As Integer
	Dim iAngularDimCount As Integer
	Dim iOtherDimCount As Integer
	iLinearDimCount = 0
	iAngularDimCount = 0
	iOtherDimCount = 0
	
    ' Iterate over all dimensions in the drawing and
    ' center them if they are linear or angular.
	' Add them to the ObjectCollection to be arranged

	oDrawingDimensions = oSheet.DrawingDimensions

	oDimsToBeArranged = ThisApplication.TransientObjects.CreateObjectCollection
	oDimsToBeArranged.Clear()
	
	Dim oAttributeSets As AttributeSets
	Dim oAttributeSet As AttributeSet
	Dim oAttribute As Inventor.Attribute
	
	'Dimensions with Arrange=False in CustomAttributeSet will not be arranged
	For Each oDrawingDimension In oDrawingDimensions
		'Get the AttributeSets
		oAttributeSets=oDrawingDimension.AttributeSets
		If oAttributeSets.NameIsUsed("CustomAttributeSet") Then 'if it has CustomAttributes
			oAttributeSet =	oAttributeSets.Item("CustomAttributeSet")
			For Each oAttribute In oAttributeSet
				If oAttribute.Name()="Arrange" Then
					If oAttribute.Value = "False" Then
						'Do nothing
					Else
						Select Case oDrawingDimension.Type
							Case 117474560	' kLinearGeneralDimensionObject
								oDimsToBeArranged.Add(oDrawingDimension)
								iLinearDimCount = iLinearDimCount+1
							Case 117474816 'kAngularGeneralDimensionObject
				'		   		oDimsToBeArranged.Add(oDrawingDimension)
				'				iAngularDimCount = iAngularDimCount+1
							Case Else
								iOtherDimCount = iOtherDimCount +1
						End Select	
					End If	
				Else 'If the dimensions has a CustomAttributeSet but no Arrange attribute it must be arranged as default
					Select Case oDrawingDimension.Type
						Case 117474560	' kLinearGeneralDimensionObject
							oDimsToBeArranged.Add(oDrawingDimension)
							iLinearDimCount = iLinearDimCount+1
						Case 117474816 'kAngularGeneralDimensionObject
			'		   		oDimsToBeArranged.Add(oDrawingDimension)
			'				iAngularDimCount = iAngularDimCount+1
						Case Else
							iOtherDimCount = iOtherDimCount +1
					End Select	
				End If
			Next	
		Else 'If the dimensions has a CustomAttributeSet it must be arranged as default		
			Select Case oDrawingDimension.Type
				Case 117474560	' kLinearGeneralDimensionObject
					oDimsToBeArranged.Add(oDrawingDimension)
					iLinearDimCount = iLinearDimCount+1
				Case 117474816 'kAngularGeneralDimensionObject
	'		   		oDimsToBeArranged.Add(oDrawingDimension)
	'				iAngularDimCount = iAngularDimCount+1
				Case Else
					iOtherDimCount = iOtherDimCount +1
			End Select
		End If			
	Next
	
	
	Trace.Writeline("Linear dimensions = "& iLinearDimCount)
	Trace.Writeline("Angular dimensions = "& iAngularDimCount)
	Trace.Writeline("Other dimensions = "& iOtherDimCount)
	
	
	oDrawingDimensions.Arrange(oDimsToBeArranged)
	

I hope this helps

 

 

Message 4 of 4

Anonymous
Not applicable

Thanks yes I have managed to use the api to place or move dimesnions thanks for the help.

 

 

0 Likes