Jump to content

Recommended Posts

Posted

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!

 

 

Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...