German Posted June 18, 2023 Posted June 18, 2023 Hello, i'm trying to hatch a dynamic block reference through VBA and i cant get it to work. A summary of the routine is as follows: --------------------------------------------------------------------------------------------------------------------------------- Dim BIMOBJ As AcadBlockReference Set BIMOBJ = ThisDrawing.ModelSpace.InsertBlock(center, BN, 1, 1, 1, Ang) --> (Dont mind those parameters, they work correctly, the block reference is inserted correctly) Dim objhatch As AcadHatch Set objhatch = ThisDrawing.ModelSpace.AddHatch(acHatchPatternTypePreDefined, "ANSI31", True, acHatchObject) Dim OuterLim() As AcadEntity ReDim OuterLim(0) --- FROM HERE ON I DONT KNOW WHAT TO DO------ Set OuterLim(0) =BIMOBJ -->>??? Dim blockent As AcadEntity: Set blockent = BIMOBJ Set OuterLim(0) =blockent -->>??? objhatch.AppendOuterLoop (OuterLim) -->This is the part that is now working. I don tknow how to define a blockreference as OuterLoop ------------------------------------------------------------------------------------------------------------------------------------------------------ By the way, if I command-hatch manualy via autocad modelspace interface, selecting the blockreference, the hatch is done correctly and works great. Any Ideas? Thanks! Quote
devitg Posted June 19, 2023 Posted June 19, 2023 On 6/18/2023 at 7:04 AM, German said: Hello, i'm trying to hatch a dynamic block reference through VBA and i cant get it to work. A summary of the routine is as follows: --------------------------------------------------------------------------------------------------------------------------------- Dim BIMOBJ As AcadBlockReference Set BIMOBJ = ThisDrawing.ModelSpace.InsertBlock(center, BN, 1, 1, 1, Ang) --> (Dont mind those parameters, they work correctly, the block reference is inserted correctly) Dim objhatch As AcadHatch Set objhatch = ThisDrawing.ModelSpace.AddHatch(acHatchPatternTypePreDefined, "ANSI31", True, acHatchObject) Dim OuterLim() As AcadEntity ReDim OuterLim(0) --- FROM HERE ON I DONT KNOW WHAT TO DO------ Set OuterLim(0) =BIMOBJ -->>??? Dim blockent As AcadEntity: Set blockent = BIMOBJ Set OuterLim(0) =blockent -->>??? objhatch.AppendOuterLoop (OuterLim) -->This is the part that is now working. I don tknow how to define a blockreference as OuterLoop ------------------------------------------------------------------------------------------------------------------------------------------------------ By the way, if I command-hatch manualy via autocad modelspace interface, selecting the blockreference, the hatch is done correctly and works great. Any Ideas? Thanks! @German better if you post at vba forum vba Quote
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.