[求助]关于填充图形的vba语句问题!
<p>想请教下如何填充图案,solid样式,就是把图形填充一种颜色就ok了</p><p>我看了二次开发的书,上面是写的</p><p>dim objhatch as acadhatch</p><p>set objhatch=thisdrawing.dodelspace.addhatch(pattype,patname,associativity,achatchobject/acgradientobject)</p><p>这个方法的参数到底要如何填写才能达到我要的效果</p><p>还有就是achatchobject和acgradentobject有什么区别</p><p>请高手指教,感激不尽</p><p></p> <a href="http://www.mjtd.com/object/acad2004/idh_addhatch.htm">http://www.mjtd.com/object/acad2004/idh_addhatch.htm</a> 谢谢,但你给的这帮助在vba里按f1就看得到,太过简略了。我试过n多参数都实现不了这些我要达到的功能 把示例程序改了一下:Sub Example_AddHatch()' 该示例在模型空间中创建关联的渐变填充图案。
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim bAssociativity As Boolean
' 定义填充图案
patternName = "solid"
PatternType = acHatchPatternTypePreDefined '0
bAssociativity = True
' 在模型空间中创建关联的 Hatch 对象
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acHatchObject)
Dim col1 As AcadAcCmColor
Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor." & Left(AcadApplication.Version, 2))
Call col1.SetRGB(255, 0, 0)
hatchObj.TrueColor = col1
' 为填充图案创建外边界(圆)
Dim outerLoop(0 To 0) As AcadEntity
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 3: center(1) = 3: center(2) = 0
radius = 1
Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
' 附着外边界到填充图案对象,并显示该填充图案
hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
ThisDrawing.Regen True
End Sub帮助文件中已经说明得非常清楚了。
<p>问题已经解决,万分感谢。一直没发现帮助的右上角还有example可以看的。。。。。呵呵</p><p>只是还想请教下achatchobject和acgradentobject有什么区别?</p>
页:
[1]