Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All
I am running IV2020 and am trying to automate some constraining.
In an assembly i have parts and subassemblies with user workplanes which I want to constrain to user workplanes in the top assembly.
I can get it to work between two parts in the top assembly, but cannot seem to get hold of the top assembly itself.
Preferably I want to be able to (in the code) define which workplanes to use by name, not by number, as this would make it very sensitive in whick order the workplanes are created.
This is what I got so far:
Btw, It is shamelessly copied from these forums, but I lost the name of the creator, sorry!
'This works, but only with two components in the assembly, 'right now with the other one set as "101153 Fond Sv gardin:1" 'What I want to do is make a constraint between a workplane in one component to a workplane in the top assembly Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition Dim compOcc1 As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Pick component") Dim compOcc2 As ComponentOccurrence = Component.InventorComponent("101153 Fond Sv gardin:1") Dim oPlane1 As WorkPlane oPlane1 = compOcc1.Definition.Workplanes("Wpl Mitt") Dim oPlane2 As WorkPlane oPlane2 = compOcc2.Definition.Workplanes("Wpl Mitt") Dim oproxyPlane1 As WorkPlaneProxy compOcc1.CreateGeometryProxy(oPlane1, oproxyPlane1) Dim oproxyPlane2 As WorkPlaneProxy compOcc2.CreateGeometryProxy(oPlane2, oproxyPlane2) Dim oConstraint As FlushConstraint oConstraint = oAsmCompDef.Constraints.AddFlushConstraint(oproxyPlane1, oproxyPlane2, 0)
Solved! Go to Solution.