Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

MacroFeature screen redraw

Status
Not open for further replies.

packmen

Mechanical
Aug 31, 2001
77
Hello everyone...

I give up... I’ve tried everything is possible... I was making a macro feature that creates a retaining ring groove… So I create a temporary cylinder with the same diameter of the shaft, other with the internal diameter of the grove, then I subtract the last from the first and finally I subtract the resulted body from the shaft main body and there should be my feature… well… it is there, I just can’t see… if I pass the mouse pointer over the feature the new feature’s faces and edges are highlighted, but I have to do a forced rebuild to see it. If I delete the feature the same happens, the display won’t update. As I’m new with macro features I tried to do another one to be sure I didn’t do any big mistake. Now my the macrofeature makes keyways, I have a shaft, then I make 2 temporary cylinders and a box between them, I made an union operation with them and to finish I subtract the resulted body from the main shaft body. Same problem… the feature is there but the model don’t update. But with this one not even the force rebuild works, I have to close the model and then reopen, this is the only way to see the keyway in the shaft. Here is the part of the code that creates the bodies and make the operations:



Function swmMain(swApp, swModel, swFeature)





















Dim swModeler As SldWorks.Modeler

Set swModeler = swApp.GetModeler



If sType = swExternalType Then

' RASGO EXTERNO

Dim sStartCyl As SldWorks.body2

Set sStartCyl = swModeler.CreateBodyFromCyl(cylDimArray)



Dim sMidBox As SldWorks.body2

Set sMidBox = swModeler.CreateBodyFromBox(boxDimArray)

iMacroFeatureData.GetEntitiesNeedUserId sMidBox, IdFaces, IdEdges



cylDimArray(0) = KeywayEnd(0)

cylDimArray(1) = KeywayEnd(1)

cylDimArray(2) = KeywayEnd(2)



Dim sEndCyl As SldWorks.body2

Set sEndCyl = swModeler.CreateBodyFromCyl(cylDimArray)



ResultBodies = sStartCyl.Operations2(SWBODYADD, sMidBox, errorCode)



ResultBodies = sEndCyl.Operations2(SWBODYADD, ResultBodies(0), errorCode)



Else

‘ not implemented yet

End If



Dim Body As Variant

Body = swModel.GetBodies2(swAllBodies, False)

Set swPartBody = Body(0)



If Not swPartBody Is Nothing Then

Dim resultBodiesPerm As Variant

resultBodiesPerm = swPartBody.Operations2(SWBODYCUT, ResultBodies(0), errorCode)

End If

End Function



Please, any help will be appreciated since there’s no reference about this part of the API in the web, at least I couldn’t find, and the help is very crap explaining these concepts :eek:(



Best regards,



Rodrigo Basniak

SolidWorks Mechanical and Piping Designer

A1 Engenharia e Gerenciamento Ltda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor