How to NOT extrude certain things in a sketch using vba ?

How to NOT extrude certain things in a sketch using vba ?

Anonymous
Not applicable
310 Views
1 Reply
Message 1 of 2

How to NOT extrude certain things in a sketch using vba ?

Anonymous
Not applicable

Hi, i have a problem, i wana extrude every closed thing besides RECT1, i tried to use command to delete from object collection, but its invallid move for my rect1 Tbh i have like 30 of them in my program and i dont wana draw lines instead of them, is there any way to solve this problem or should i rewrite my rectangles? Maybe there is other method to draw rectangles ? The part of a code looks like this:

 

 Dim Nt31 As Point2d = _TG.CreatePoint2d(Taskas18.X, NLinija.Geometry.MidPoint.Y + F3) '_TG is transient gemoetry
            Dim Nt32 As Point2d = _TG.CreatePoint2d(Taskas23.X, NLinija.Geometry.MidPoint.Y)
            Dim Rect1 As SketchEntitiesEnumerator = _Skpagrindinis.SketchLines.AddAsTwoPointRectangle(Nt31, Nt32)

        End If
        

      
        Dim sides As Integer
        sides = 3
        Dim trikampiocentras As Point2d = _TG.CreatePoint2d(Taskas19.X + 0.1, Taskas19.Y)
        Dim trikampioApskritimoKrastas As Point2d = _TG.CreatePoint2d(Taskas19.X + 0.2, Taskas19.Y)
        Dim trikampia As SketchEntitiesEnumerator = _Skpagrindinis.SketchLines.AddAsPolygon(sides, trikampiocentras, trikampioApskritimoKrastas, True)

        ''  Dim objcol As ObjectCollection  'nereikia kolkas traukti trikampio i object collectionsa nes jis ir taip yram, reikai tikrais teksta
        ''  objcol = _invApp.TransientObjects.CreateObjectCollection
        ''  objcol.Remove(rect1)- doesnt work cause invalid move for this type of object
        Dim ProfilisTr As Profile
        ProfilisTr = _Skpagrindinis.Profiles.AddForSolid()
      
        Dim extrud As ExtrudeDefinition
        extrud = _PartCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(ProfilisTr, PartFeatureOperationEnum.kJoinOperation)
        extrud.SetDistanceExtent(1, PartFeatureExtentDirectionEnum.kPositiveExtentDirection)
        Dim ex As ExtrudeFeature
        ex = _PartCompDef.Features.ExtrudeFeatures.Add(extrud)

 

 

Now the result is trikampia object which is triangle i wanna to be extruded is extruded with rect1to rect 30 objects which i dont wana to be extruded 😞

I am planning to add other object for this dynamic drawing and i cant get along without rectangles... Code is like 400 lines now and dont rly wana redo it, plz help.

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

Anonymous
Not applicable

Ok, i made it 🙂 the code was the following:

 

Dim ProfilisTr As Profile
        ProfilisTr = _Skpagrindinis.profiles.addforsolid



        '' Neisextrudina staciakampiu

        ProfilisTr.Item(2).AddsMaterial = False
        ProfilisTr.Item(3).AddsMaterial = False
        ProfilisTr.Item(4).AddsMaterial = False

and so on................ the funny thing i had 30 items and 31 profiles, question is what is the #1 profile? Tried to mess with it it does nothing...

 

 

 

0 Likes