Tipo166 Posted December 12, 2008 Share Posted December 12, 2008 Hello All, I need to hatch a region w/ multiple areas: Tried modding the example code for : Public Function AddHatch(Region As AcadRegion) As AcadHatch ' This example creates an associative gradient hatch in model space. Dim patternName As String Dim PatternType As Long Dim bAssociativity As Boolean Dim outerLoop() As AcadEntity ReDim outerLoop(0) Dim oplineReg As AcadEntity Set oplineReg = Region.Copy Set outerLoop(0) = Region ' Define the hatch patternName = "CYLINDER" PatternType = acPreDefinedGradient '0 bAssociativity = True ' Create the associative Hatch object in model space Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject) Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.17") Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.17") Call col1.SetRGB(255, 0, 0) Call col2.SetRGB(0, 255, 0) hatchObj.GradientColor1 = col1 hatchObj.GradientColor2 = col2 ' Append the outerboundary to the hatch object, and display the hatch hatchObj.AppendOuterLoop outerLoop hatchObj.Evaluate ThisDrawing.Regen True End Function invalid input here: hatchObj.AppendOuterLoop outerLoop obviously there is no "OuterLoop" but its really simple to hatch the object using the std autocad Hatch command and the options with it. Any ideas? thanks, trent Quote Link to comment Share on other sites More sharing options...
rmorton@gocfi.com Posted June 30, 2009 Share Posted June 30, 2009 I seem to have the same problem Quote Link to comment Share on other sites More sharing options...
mtrasi Posted July 27, 2009 Share Posted July 27, 2009 did you try Dim outerLoop(0) As AcadEntity instead of Dim outerLoop() As AcadEntity ReDim outerLoop(0) sometimes vba mistake from variant to other types... Do you have this problem with every region or only some of them? For me this kind of approach: appending loop - evaluating, always worked with closed objects (and a region is closed) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.