OffsetSketchEntitiesUsingDistance always constrains

OffsetSketchEntitiesUsingDistance always constrains

JamieVJohnson2
Collaborator Collaborator
473 Views
1 Reply
Message 1 of 2

OffsetSketchEntitiesUsingDistance always constrains

JamieVJohnson2
Collaborator
Collaborator

This program has the option to set false to create geometric constraints.  I set it to false, it still created the constraints.  This is causing my dimensions to come out in error because of the additional constriants.  I can and will right code to delete the constraints right after they are created, but this routine should not be creating them if set to false:

        Function OffsetSketchEntitiesUsingDistance(SketchEntities As ObjectCollection, OffsetDistance As Double, NaturalOffsetDirection As Boolean, Optional IncludeConnectedEntities As Boolean = False, Optional CreateOffsetConstraints As Boolean = True) As SketchEntitiesEnumerator

 

slocProfile is an object collection of sketch lines only.  The end result each time if set to true or false, is creation of the "Equal" offset constraint.

 

        Dim seeOffsetProfile As SketchEntitiesEnumerator = skProfile.OffsetSketchEntitiesUsingDistance(slocProfile, -0.5 * 2.54, False, False)

Please fix, or show me what I am doing wrong.

 

Thank you,

 

jvj

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
474 Views
1 Reply
Reply (1)
Message 2 of 2

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

I created a small VBA code and a rectangle in a sketch. It works well with 'CreateOffsetConstraints = false'. After the code, the orignal geometries has not offset constraint with the new geometries. 

 

If you still have the problem, could you provide test code and file for us to investigate?

 

Sub testOffsetSketchEntitiesUsingDistance()

    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument
    
    Dim oDocDef As PartComponentDefinition
    Set oDocDef = oPartDoc.ComponentDefinition
    
    Dim oSketch As Sketch
    Set oSketch = oDocDef.Sketches(1)
    
    Dim oTransGeom As TransientGeometry
    Set oTransGeom = ThisApplication.TransientGeometry
    
    Dim oCollection As ObjectCollection
    Set oCollection = ThisApplication.TransientObjects.CreateObjectCollection()
    
    
    
    oCollection.Add oSketch.SketchLines(1)
    oCollection.Add oSketch.SketchLines(2)
    oCollection.Add oSketch.SketchLines(3)
    oCollection.Add oSketch.SketchLines(4)
    
     
    
    Dim cons As Boolean
    cons = False
    Call oSketch.OffsetSketchEntitiesUsingDistance(oCollection, 4, False, False, cons)
    
    
End Sub


'CreateOffsetConstraints = true'

cons-true.png

 

 

'CreateOffsetConstraints = false'

 

cons-false.png

0 Likes