Find workpoints in flat pattern

Find workpoints in flat pattern

Anonymous
Not applicable
517 Views
4 Replies
Message 1 of 5

Find workpoints in flat pattern

Anonymous
Not applicable

Hi,

 

I have created workpoints on my flat pattern that I want to use for dimensioning. 

 

I have the following code which is able to find the workpoints in the folded part but not the flat pattern:

 

 

Dim oDrawingDocument As DrawingDocument = ThisServer.ActiveDocument
Dim oSheet As Sheet = oDrawingDocument.ActiveSheet
Dim oView As DrawingView = ActiveSheet.View("VIEW7").View
Dim oPartDocument As PartDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
'Dim oComponentOcc As ComponentOccurrence = oAssemblyDoc.ComponentDefinition.Occurrences.Item(1)
'Dim oPartDocument As PartDocument = oComponentOcc.Definition.Document
Dim oWorkPoint1 As WorkPoint = oPartDocument.ComponentDefinition.WorkPoints.Item(2)
MsgBox(oPartDocument.ComponentDefinition.WorkPoints.Count)
MsgBox( oWorkPoint1.Name)
MsgBox( oWorkPoint1.Point.X)
MsgBox( oWorkPoint1.Point.Y)

Could anyone help me get the workpoints from the flat pattern.


Thanks,

Thomas

0 Likes
518 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor
How many workpoints did you create?
And which of them do you need to have?
the workpoints.item start at "0" so if you need workpoint 2 you need item(1)!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi is your question solve?How you get the work point of flat pattern?

 

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Hi @Anonymous.  That is a good question, but its answer can be complicated to explain.  If those WorkPoints were truly created within the FlatPattern, then you will need to dig down to the FlatPattern of the model to be able to get to them.  The FlatPattern is like its own ComponentDefinition, and has its own WorkPoints collection.  It can only be found within a SheetMetalComponentDefinition, so you first have to get the part's component definition as that type of component definition.  Then you can step down within that to get its FlatPattern, if one has been created.

Here is a fairly simple example iLogic code that can be used while you have a sheet metal part open & 'active'.

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule to work. Exiting.", vbCritical, "iLogic")
	Exit Sub
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
If TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then 
	Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
	If oSMDef.HasFlatPattern Then
		oFP = oSMDef.FlatPattern
		oWPs = oFP.WorkPoints
		'do what you want with those WorkPoints here
		MsgBox("Found the FlatPattern's WorkPoints.", vbInformation, "iLogic")
	End If
End If

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

Anonymous
Not applicable

@WCrihfield  Many Thanks for sharing the code, yes its very much useful & solved my need.

0 Likes