dimensioning

dimensioning

Anonymous
Not applicable
364 Views
3 Replies
Message 1 of 4

dimensioning

Anonymous
Not applicable
Hi,

I did post a topic a couple of days ago, but no response........Helppppp

Does anyone have an example of how to select 2 lines in a drawing of a large assembly & add a dimension.

I have gone through the programming help, but no luck.

Thanks in advance.

Martin
0 Likes
365 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
This task essentially involves mapping between geometries in the model to
the geometries (edges) in the drawing. The problem, though, is that not all
geometries in the model manifest in the drawing (since hidden edges from the
model are completely removed from the drawing view). For the simple case
where the model edges do show up in the drawing, you can use the
DrawingView.DrawingCurves property to retrieve the drawing edge. The input
to the property should be the model edge or face and the corresponding
drawing curve(s) will be returned. If this property does not return anything
for a model edge/face, you have to use an alternative technique to get the
drawing curves. And the alternative is only possible in Inventor 2008 (
using the new Sheet.FindUsingPoint method ). The idea here is to find a few
sample model points that lie on the model edge of interest, transform those
points to the drawing sheet space (using DrawingView.ModelToSheetSpace) and
finally using the transformed points to locate drawing geometries (using
Sheet.FindUsingPoint).

Sounds easy, doesn't it? 🙂 Unfortunately, automating drawing dimension and
symbol creation does involve this level of complexity and there isn't an
easy way around it.

Sanjay-


wrote in message news:5582716@discussion.autodesk.com...
Hi,

I did post a topic a couple of days ago, but no response........Helppppp

Does anyone have an example of how to select 2 lines in a drawing of a large
assembly & add a dimension.

I have gone through the programming help, but no luck.

Thanks in advance.

Martin
0 Likes
Message 3 of 4

Anonymous
Not applicable
Sanjay,

Thanks for the reply, It is good to hear that the process is not easy, I thought it was just me!!

The problem I was having was getting my mind around the DrawingView.DrawingCurves property, am I right in thinking that this is used for selecting lines as well as curves?

With reference to the new Sheet.FindUsingPoint method can this locate workpoints that are already placed on the appropriate sub assembly or does it only find the corner points etc.

regards

Martin

PS Do you have any code samples you could share?
0 Likes
Message 4 of 4

Anonymous
Not applicable
<<...am I right in thinking that this is used for selecting lines as well as
curves?>>

Yes, this property returns all draiwng curves regardless of the curve type
(lines, arcs, circles, etc.)

<
workpoints that are already placed on the appropriate sub assembly or does
it only find the corner points etc.>>

The method finds all drawing edges, centerlines, centermarks and sketch
entities at the point.

I've attached a sample below. It may not be exactly what you want for your
workflow, but shows the general idea.

Sanjay-


Sub ModelToDrawing()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDrawingView As DrawingView
Set oDrawingView = oDoc.ActiveSheet.DrawingViews.Item(1)

' Get the entity from the model (edge, face, etc.)
Dim oModelEntity As Object
Set oModelEntity = .........

Dim oDrawingCurves As DrawingCurvesEnumerator
Set oDrawingCurves = oDrawingView.DrawingCurves(oModelEntity)

If Not oDrawingCurves Is Nothing Then
If oDrawingCurves.Count > 0 Then

Dim oCurve As DrawingCurve
For Each oCurve In oDrawingCurves
Dim oCurveSegment As DrawingCurveSegment
For Each oCurveSegment In oCurve.Segments
oDoc.SelectSet.Select oCurveSegment
Next
Next
End If
Else
If TypeOf oModelEntity Is Edge Then

Dim oModelEdge As Edge
Set oModelEdge = oModelEntity

Dim params(1) As Double
params(0) = 0.25
params(1) = 0.75

Dim points(5) As Double

Call oModelEdge.Evaluator.GetPointAtParam(params, points)

Dim oModelPoint1 As Point
Set oModelPoint1 =
ThisApplication.TransientGeometry.CreatePoint(points(0), points(1),
points(2))

Dim oSheetPoint1 As Point2d
Set oSheetPoint1 = oDrawingView.ModelToSheetSpace(oModelPoint1)

Dim oModelPoint2 As Point
Set oModelPoint2 =
ThisApplication.TransientGeometry.CreatePoint(points(3), points(4),
points(5))

Dim oSheetPoint2 As Point2d
Set oSheetPoint2 = oDrawingView.ModelToSheetSpace(oModelPoint2)

If Not oSheetPoint1.IsEqualTo(oSheetPoint2) Then

oDoc.Activate

Dim oCurves1 As ObjectsEnumerator
Set oCurves1 =
oDrawingView.Parent.FindUsingPoint(oSheetPoint1)

Dim oCurves2 As ObjectsEnumerator
Set oCurves2 =
oDrawingView.Parent.FindUsingPoint(oSheetPoint2)

' If both sample points find the same curve, the curve is of
interest
Dim oCurve1 As Object
Dim oCurve2 As Object
For Each oCurve1 In oCurves1
For Each oCurve2 In oCurves2
If oCurve1 Is oCurve2 Then
oDoc.SelectSet.Select oCurve1
End If
Next
Next

End If
End If
End If
End Sub


wrote in message news:5584709@discussion.autodesk.com...
Sanjay,

Thanks for the reply, It is good to hear that the process is not easy, I
thought it was just me!!

The problem I was having was getting my mind around the
DrawingView.DrawingCurves property, am I right in thinking that this is used
for selecting lines as well as curves?

With reference to the new Sheet.FindUsingPoint method can this locate
workpoints that are already placed on the appropriate sub assembly or does
it only find the corner points etc.

regards

Martin

PS Do you have any code samples you could share?
0 Likes