lhkz 发表于 2004-4-20 19:15:00

[请教]怎样任意建立工作轴和工作面?

一个菜鸟问题。赫赫


谢谢各位高手!

lzh1600 发表于 2004-4-20 19:49:00

这个问题问得实在有点太大了,叫人没法回答,建议你先看看书。

sixsixsix 发表于 2004-4-20 21:33:00

您最好能举出一个几何上讲得通(有确定的唯一解),实际上没法做出的案例,大家才好“七嘴八舌”。

陈伯雄 发表于 2004-4-21 09:00:00

应当没有“任意”的可能。


必须是具有确切的关联约束才行...

lhkz 发表于 2004-4-21 11:47:00

问题是这样的:


在用VBA编程时,需要建立自己的工作平面或者轴,例如需要建立一个与xy 、yz平面均成45度角的工作平面用VBA 程序怎么实现?


跟确切,就是我在进行阵列时,想通过建立一个自己的工作轴进行阵列(如图所画),该怎么建立呢?


代码如下:


<BR>        PI = 4 * Atn(1)


Dim myDocPart As PartDocument<BR>Dim myComDef As PartComponentDefinition<BR>Dim mySketch As PLanarSketch<BR>Dim myRect As SketchEntitiesEnumerator               '<BR>Dim myTrGm As TransientGeometry<BR>Dim myProfile As Profile<BR>Dim myPt1 As Point2d<BR>Dim myPt2 As Point2d


Dim myExtrude As ExtrudeFeature


<BR>Set myDocPart = ThisApplication.Documents.Add(kPartDocumentObject, , True)<BR>Set myComDef = myDocPart.ComponentDefinition<BR>Set mySketch = myComDef.Sketches.Add(myComDef.WorkPlanes(3))


Set myTrGm = ThisApplication.TransientGeometry


<BR>Set myPt1 = myTrGm.CreatePoint2d(0, 0)<BR>Set myPt2 = myTrGm.CreatePoint2d(10, 10)<BR>Set myRect = mySketch.SketchLines.AddAsTwoPointRectangle(myPt1, myPt2)


Set myProfile = mySketch.Profiles.AddForSolid


Set myExtrude = myComDef.Features.ExtrudeFeatures.AddByDistanceExtent(myProfile, 1, kNegativeExtentDirection, kJoinOperation)<BR>'Set myExtrude = myComDef.Features.ExtrudeFeatures.AddByDistanceExtent(myProfile, 1, kNegativeExtentDirection, kJoinOperation)


'在得到的拉伸实体的顶面建立草图<BR>Dim myFace As Face<BR>Set myFace = myExtrude.StartFaces.Item(1)<BR>Set mySketch = myComDef.Sketches.Add(myFace)


Set myPt1 = myTrGm.CreatePoint2d(1, 1)<BR>Set myPt2 = myTrGm.CreatePoint2d(2.5, 2.5)


Set myRect = mySketch.SketchLines.AddAsTwoPointRectangle(myPt1, myPt2)


'拉通小槽<BR>Set myProfile = mySketch.Profiles.AddForSolid<BR>Dim myExtruct1 As ExtrudeFeature<BR>Set myExtruct1 = myComDef.Features.ExtrudeFeatures.AddByThroughAllExtent(myProfile, kNegativeExtentDirection, kCutOperation)


       


'阵列 圆形阵列


dim myFeatColl As ObjectCollection<BR>Set myFeatColl = ThisApplication.TransientObjects.CreateObjectCollection<BR>myFeatColl.Add myExtruct1


Dim myXaxis As WorkAxis<BR>Set myXaxis = myComDef.WorkAxes.Item(1) 'X<BR>Dim myYaxis As WorkAxis<BR>Set myYaxis = myComDef.WorkAxes.Item(2) 'Y<BR>Dim myZaxis As WorkAxis<BR>Set myZaxis = myComDef.WorkAxes.Item(3) 'Z


myZaxis.Visible = True


<BR>Dim myCircPattern As CircularPatternFeature<BR>Dim myStartPt As SketchPoint<BR>Set myStartPt = mySketch.SketchPoints.Add(myPt2)<BR>Set myCircPattern = myComDef.Features.CircularPatternFeatures.Add(myFeatColl, myZaxis, True, 8, 2 * PI, True, True)


'问题在于我想建立 自己的旋转轴(图中所画)取代上一行代码中的 myZaxis(图中的z轴,黄色)


<BR>

lhkz 发表于 2004-4-21 11:50:00

陈伯雄 发表于 2004-4-21 12:01:00

这种需求为什么要用程序实现?

lhkz 发表于 2004-4-21 12:07:00

因为爱好,觉得因该可以的。


我是买了您的 Inventor R6-VB(A)程序设计


一书才,觉得编程有意思,才这么做的。


请陈老师帮忙。
页: [1]
查看完整版本: [请教]怎样任意建立工作轴和工作面?