Adding Surface Texture to FlatPattern View

Adding Surface Texture to FlatPattern View

miha_bokan
Enthusiast Enthusiast
214 Views
4 Replies
Message 1 of 5

Adding Surface Texture to FlatPattern View

miha_bokan
Enthusiast
Enthusiast

I am trying to enrich my "auto-weldment-drawing", which automatically adds all necessary views and also raw parts that need to be cut, bend, before welding.

 

My program works actually pretty good, but I want to add surface texture symbol to sheet metal flat pattern views. There isn't much resources about ilogc-surface, so I am kind of stuck... 😕

 

miha_bokan_0-1740520640975.png

 

Anyone up to the challenge?

0 Likes
Accepted solutions (1)
215 Views
4 Replies
Replies (4)
Message 2 of 5

marcin_otręba
Advisor
Advisor
Accepted solution

hi,

 

you can start from this:

 

Dim drw As DrawingDocument = ThisDoc.Document
Dim osheet As Sheet = drw.ActiveSheet
For Each oDv As DrawingView In osheet.DrawingViews
	If oDv.IsFlatPatternView Then
		drw.SelectSet.Clear
		drw.SelectSet.Select(oDv)
		If oDv.Camera.Eye.X > oDv.Camera.Eye.Z Or oDv.Camera.Eye.Y > oDv.Camera.Eye.Z Then ' if flat pattern view is side view
			Dim oiptdoc As PartDocument = oDv.ReferencedDocumentDescriptor.ReferencedDocument
			Dim ft As FlatPattern = oiptdoc.ComponentDefinition.flatpattern
			Dim oFT As Object = ft.TopFace
			Dim oFB As Object = ft.BottomFace
			Dim oDvCT As DrawingCurve = oDv.DrawingCurves(oFT)(1) ' get first drawing view curve from top flatpattern face
	 		Dim oMidPointT As Point2d = oDvCT.MidPoint
			Dim oDvCB As DrawingCurve = oDv.DrawingCurves(oFB)(1) ' get first drawing view curve from bottomflatpattern face
	 		Dim oMidPointB As Point2d = oDvCB.MidPoint
	    	' Set a reference to the TransientGeometry object.
	    	Dim oTG As TransientGeometry= ThisApplication.TransientGeometry
	    	Dim oLeaderPointsT As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	    	' Create a few leader points.
	    	Call oLeaderPointsT.Add(oTG.CreatePoint2d(oMidPointT.X, oMidPointT.Y))
	     	' Create an intent and add to the leader points collection.
		    ' This is the geometry that the leader text will attach to.
		    Dim oGeometryIntentT As GeometryIntent = osheet.CreateGeometryIntent(oDvCT,oMidPointT)
		
		    Call oLeaderPointsT.Add(oGeometryIntentT)
			
		  	Dim oLeaderPointsB As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
		    ' Create a few leader points.
		    Call oLeaderPointsB.Add(oTG.CreatePoint2d(oMidPointB.X, oMidPointB.Y))
		     ' Create an intent and add to the leader points collection.
		    ' This is the geometry that the leader text will attach to.
		    Dim oGeometryIntentB As GeometryIntent = osheet.CreateGeometryIntent(oDvCB,oMidPointB)
		    Call oLeaderPointsB.Add(oGeometryIntentB)
		
		 	Dim oSymbolT As SurfaceTextureSymbol
		 	oSymbolT = osheet.SurfaceTextureSymbols.Add(oLeaderPointsT,kMaterialRemovalProhibitedSurfaceType)
			Dim oSymbolB As SurfaceTextureSymbol
		    oSymbolB = osheet.SurfaceTextureSymbols.Add(oLeaderPointsB,kMaterialRemovalProhibitedSurfaceType)
	
		End If
	End If
Next

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 5

miha_bokan
Enthusiast
Enthusiast

The orientation of symbol is sometimes not right, but still good enough for me and use.

 

Tnx a ton !

0 Likes
Message 4 of 5

Stephane_Hemberger
Participant
Participant

Hello everyone,

Thanks a lot for the detailed explanation and clear solution.

Has anyone found a way to define the orientation or the side of the line on which the surface texture symbol should be drawn?
I'm currently facing the issue that I don't know how to set this, and the symbol always appears on the side that is facing downward - regardless of whether it's the "material" side or the "air" side of the line.

Thanks in advance for any replies!

Best regards,

Stéphane Hemberger

0 Likes
Message 5 of 5

marcin_otręba
Advisor
Advisor

ou can play with leaderpoints:

 

Dim drw As DrawingDocument = ThisDoc.Document
Dim osheet As Sheet = drw.ActiveSheet
For Each oDv As DrawingView In osheet.DrawingViews
	If oDv.IsFlatPatternView Then
		drw.SelectSet.Clear
		drw.SelectSet.Select(oDv)
		If oDv.Camera.Eye.X > oDv.Camera.Eye.Z Or oDv.Camera.Eye.Y > oDv.Camera.Eye.Z Then ' if flat pattern view is side view
			Dim oiptdoc As PartDocument = oDv.ReferencedDocumentDescriptor.ReferencedDocument
			Dim ft As FlatPattern = oiptdoc.ComponentDefinition.flatpattern
			Dim oFT As Object = ft.TopFace
			Dim oFB As Object = ft.BottomFace
			Dim oDvCT As DrawingCurve = oDv.DrawingCurves(oFT)(1) ' get first drawing view curve from top flatpattern face
	 		Dim oMidPointT As Point2d = oDvCT.MidPoint
			Dim oDvCB As DrawingCurve = oDv.DrawingCurves(oFB)(1) ' get first drawing view curve from bottomflatpattern face
	 		Dim oMidPointB As Point2d = oDvCB.MidPoint
	    	' Set a reference to the TransientGeometry object.
	    	Dim oTG As TransientGeometry= ThisApplication.TransientGeometry
	    	Dim oLeaderPointsT As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	    	' Create a few leader points.
			If Abs(oMidPointT.X - oDv.Left) >= oDv.Width Then
				Call oLeaderPointsT.Add(oTG.CreatePoint2d(oDv.Left+ oDv.Width, oMidPointT.Y))
				Else
					Call oLeaderPointsT.Add(oTG.CreatePoint2d(oDv.Left , oMidPointT.Y))
				End If
	    	
	     	' Create an intent and add to the leader points collection.
		    ' This is the geometry that the leader text will attach to.
		    Dim oGeometryIntentT As GeometryIntent = osheet.CreateGeometryIntent(oDvCT,oMidPointT)
		'Call oLeaderPointsT.Add(oTG.CreatePoint2d(oMidPointT.X,oDv.Left))
		    Call oLeaderPointsT.Add(oGeometryIntentT)
			
		  	Dim oLeaderPointsB As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
		    ' Create a few leader points.
			
		  If Abs(oMidPointB.X - oDv.Left) >= oDv.Width Then
				Call oLeaderPointsB.Add(oTG.CreatePoint2d(oDv.Left, oMidPointB.Y))
				Else
					Call oLeaderPointsB.Add(oTG.CreatePoint2d(oDv.Left + oDv.Width, oMidPointB.Y))
				End If
		     ' Create an intent and add to the leader points collection.
		    ' This is the geometry that the leader text will attach to.
		    Dim oGeometryIntentB As GeometryIntent = osheet.CreateGeometryIntent(oDvCB,oMidPointB)
		    Call oLeaderPointsB.Add(oGeometryIntentB)
		
		 	Dim oSymbolT As SurfaceTextureSymbol
		 	oSymbolT = osheet.SurfaceTextureSymbols.Add(oLeaderPointsT,kMaterialRemovalProhibitedSurfaceType)
			Dim oSymbolB As SurfaceTextureSymbol
		    oSymbolB = osheet.SurfaceTextureSymbols.Add(oLeaderPointsB,kMaterialRemovalProhibitedSurfaceType)

		End If
	End If
Next

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders