Hide specific line in a view

Hide specific line in a view

artemijs.nille
Contributor Contributor
694 Views
7 Replies
Message 1 of 8

Hide specific line in a view

artemijs.nille
Contributor
Contributor

How can i hide a line in a view of a drawing by using created Intent in the 3D.

Dim AnsaugDKanteDSInnen = Deckscheibe.GetIntent("AnsaugDKanteDSInnen")

Picture below.

Thank you in advance

0 Likes
Accepted solutions (1)
695 Views
7 Replies
Replies (7)
Message 2 of 8

yan.gauthier
Advocate
Advocate

Hi, 

 

DrawingView.DrawingCurves can take a ModelObject to return the DrawingCurves associated the the model object

 

DrawingView.DrawingCurves( [ModelObject] As Variant ) As DrawingCurvesEnumerator

 

ModelObjectVariantOptional input object that specifies the object from the model for which the corresponding drawing view curves need to be retrieved. This could be an Edge, Face, PartFeature, Sketch, SketchEntity, Sketch3D, SketchEntity3D, ComponentOccurrence, or the proxies to any of these. If not specified, all the edges from the drawing view are returned.

This is an optional argument whose default value is null.

 

Get your edge from your intent and pass it. from there, access the DrawingCurveSegment and set visibility to false.

0 Likes
Message 3 of 8

artemijs.nille
Contributor
Contributor

Thank you for a reply.

Sorry but i don't understand.

I put my intent as you said but it doesnt work.

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Blatt:1")
Dim Deckscheibe = Sheet_1.DrawingViews.ItemByName("Part 3 / Teil 3")

Dim AnsaugDKanteDSAussen = Deckscheibe.GetIntent("AnsaugDKanteDSAussen")

DrawingView.DrawingCurves(AnsaugDKanteDSAussen) As DrawingCurvesEnumerator
0 Likes
Message 4 of 8

basautomationservices
Advocate
Advocate
DrawingView.DrawingCurves(AnsaugDKanteDSAussen) As DrawingCurvesEnumerator

 

This doesn't work because it is not a valid line of code. The rule shouldn't even run. 

Contact me for custom app development info@basautomationservices.com. Follow below links to view my Inventor appstore apps.

Free apps: Smart Leader | Part Visibility Utility | Mate Origins

Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro


0 Likes
Message 5 of 8

artemijs.nille
Contributor
Contributor

Do you know how should i change the code that it works?

0 Likes
Message 6 of 8

basautomationservices
Advocate
Advocate

The DrawingCurvesEnumerator that is returned by the line below, holds the collection of curves matching the criteria between the brackets. 

 

DrawingView.DrawingCurves(AnsaugDKanteDSAussen) 

 

The DrawingCurvesEnumerator should, as anything else, be stored in a variable. This you did before in your rule and also applies here. (dim)

 

Dim dwgCurvesEnum as DrawingCurvesEnumerator = DrawingView.DrawingCurves(AnsaugDKanteDSAussen) 

 

The variable 'dwgCurvesEnum' will now hold the curves. In this case I will assume there is more than one curve returned, and there is only one that you need. You can then access that curve as follows.

 

Dim curve as DrawingCurve = dwgCurvesEnum.Item(1)

 

To get a bit better feeling I suggest reading the documentation of the Inventor API. Also download Visual Studio so you can debug your rules (https://modthemachine.typepad.com/my_weblog/2019/12/using-visual-studio-to-debug-ilogic-rules.html), and actually see what is going on each line. 

 

Contact me for custom app development info@basautomationservices.com. Follow below links to view my Inventor appstore apps.

Free apps: Smart Leader | Part Visibility Utility | Mate Origins

Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro


0 Likes
Message 7 of 8

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

@basautomationservices 

AnsaugDKanteDSAussen is an GeometryIntent, so DrawingView.DrawingCurves(AnsaugDKanteDSAussen) will not work direct.

 

@artemijs.nille 

try

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Blatt:1")
Dim Deckscheibe = Sheet_1.DrawingViews.ItemByName("Part 3 / Teil 3")
Dim AnsaugDKanteDSAussen = Deckscheibe.GetIntent("AnsaugDKanteDSAussen")

Dim oDrawCurve As DrawingCurve
Dim oDrawCurves As DrawingCurvesEnumerator
Dim oDrawCurveSeg As DrawingCurveSegment

If AnsaugDKanteDSAussen.Geometry.type = ObjectTypeEnum.kDrawingCurveObject Then
	oDrawCurve = DirectCast(AnsaugDKanteDSAussen.Geometry,DrawingCurve)
	oDrawCurves = oView.DrawingCurves(oDrawCurve.ModelGeometry)
	For Each oDrawCurve In oDrawCurves
		For Each odrawcurveseg In oDrawCurve.Segments
			oDrawCurveSeg.Visible=False
		Next
	Next
End If

 

It would always be a good idea to use the "Option Explicit On" switch in every rule header. If you know what type a variable is (cause you need to explicitly declare it), it's much easier to find and understand things that won't work and why.


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 8 of 8

artemijs.nille
Contributor
Contributor

Thank you very much Mr. krieg.

0 Likes