VBA Creating path from derived sketch block

VBA Creating path from derived sketch block

Anonymous
Not applicable
766 Views
1 Reply
Message 1 of 2

VBA Creating path from derived sketch block

Anonymous
Not applicable

Hi everyone.

 

I've got a problem with creating Path in Inventor VBA. I've created a source block definition in SourcePart.ipt, derived it in DestPart.ipt, placed this derived SketchBlockDefinition in Sketch3 and draw 3 extra lines. Now i want to add a SplitFeature with SplitTool as a Path of 3 lines, but first i need to create this Path. There is no problem with creating path from this 3 extra lines, but when i want to create path from lines that belongs to derived block - an error occurs. 

 

Below is sample code (also included in attached file - DestPart.ipt). Try run it with DestPart.ipt as an active file. When Inventor is prompting for Selecting Sketch Entity first select one of 3 extra lines, macro ends with no errors. Then run it again, this time select one of 3 lines that belongs to SketchBlock - an error occurs.

 

When you try to add SplitFeature (Trim Solid) by UserInterface Button "Split" there is no problem with any set of 3 lines.

 

Sub CreatePathTest()

    Dim oPartDoc As Inventor.PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument

    Dim oPickedSketchEntity As Inventor.SketchEntity
    Set oPickedSketchEntity = ThisApplication.CommandManager.Pick(kSketchCurveFilter, "Select Sketch Entity")
    
    Dim oNewPath As Inventor.Path
    Set oNewPath = oPartDoc.ComponentDefinition.Features.CreatePath(oPickedSketchEntity)

End Sub

My System is Windows 7 32bit/64bit, Inventor 2012 

 

Thanks in advance for any help.

 

0 Likes
767 Views
1 Reply
Reply (1)
Message 2 of 2

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

This is an issue which has been logged:

SkBlock, Path: CreatePath and CreateSpecifiedPath doesn't work for sketch block curve.

 

And it exists in 2014 as well. Sorry if this is a bas news for you.

 

 

0 Likes