Cross-Part Projected Edges from within assembly environment

Cross-Part Projected Edges from within assembly environment

MechMachineMan
Advisor Advisor
311 Views
0 Replies
Message 1 of 1

Cross-Part Projected Edges from within assembly environment

MechMachineMan
Advisor
Advisor

Looking for some help/guidance doing this.

 

Essentially what I'm doing is creating a macro that will allow a user to select a face, and based upon that face, will automatically create an offset plane and then project cut edges from in the assembly and then cut that out in order to make a slot/tab system more efficient.

 

Currently stuck at the part where i need to project the loop of the tab from the other parts in the assembly. See the code/example parts attached.

 

 

Dim oAsmDoc As Document
oAsmDoc = ThisApplication.ActiveDocument

Dim oFace As Face

Dim oCmdMgr As CommandManager = ThisApplication.CommandManager
oFace = oCmdMgr.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select Face to mate with tabbed plate")

Dim oPartOcc As ComponentOccurrence
oPartOcc = oFace.Parent.Parent

Dim oPCD As PartComponentDefinition
oPCD = oFace.Parent.Parent.Definition

Dim oSlotPlane As WorkPlane
oSlotPlane = oPCD.WorkPlanes.AddByPlaneAndOffset(oFace.NativeObject, "-1/64 in")
oSlotPlane.Name = "SLOT PLANE"

Dim oSlotSketch As PlanarSketch
oSlotSketch = oPCD.Sketches.Add(oSlotPlane)
oSlotSketch.Name = "Slot Sketch"

Dim oSketchProxy As PlanarSketchProxy
oPartOcc.CreateGeometryProxy(oSlotSketch, oSketchProxy)

'''Option A'' Attempt at using direct calls
	oSketchProxy.ProjectedCuts.Add
'''End option A

'''Option B'' Attempt at using control definitions
'	Dim oSS As SelectSet
'	oSS = oAsmDoc.SelectSet
'	
'	oSketchProxy.Edit
'	
'	Dim oDef As ControlDefinition
'	oDef = ThisApplication.CommandManager.ControlDefinitions.Item("SketchProjectCutEdgesCmd")
'	oDef.Execute
'	
'	oSketchProxy.ExitEdit
'End option B''' 

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
312 Views
0 Replies
Replies (0)