<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: R14 AddHatchMethod Question in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313625#M95784</link>
    <description>Nice line art David &lt;G&gt;. It's "supposed" to be a target symbol, right?! Why&lt;BR /&gt;
don't you just make a _small_ .jpg of the actual AutoCAD screen, and attach&lt;BR /&gt;
the image to an HTML formatted post?&lt;BR /&gt;
&lt;BR /&gt;
Sorry, I can't help on the actual question, never messed with that yet. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
R. Robert Bell, MCSE&lt;BR /&gt;
Network Administrator (or, Modern-day Wizard)&lt;BR /&gt;
(remove the "not." in my address for direct e-mail)&lt;/G&gt;</description>
    <pubDate>Fri, 11 Feb 2000 18:10:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-02-11T18:10:55Z</dc:date>
    <item>
      <title>R14 AddHatchMethod Question</title>
      <link>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313624#M95783</link>
      <description>Is there a way, using VBA and R14.01, to create a *derived* associative hatch?&lt;BR /&gt;
&lt;BR /&gt;
Example:&lt;BR /&gt;
&lt;BR /&gt;
        |&lt;BR /&gt;
        |&lt;BR /&gt;
     .--+--.&lt;BR /&gt;
    | + |   |&lt;BR /&gt;
----+---+---+----&lt;BR /&gt;
    |   | + |&lt;BR /&gt;
     `--+--´&lt;BR /&gt;
        |&lt;BR /&gt;
        |&lt;BR /&gt;
&lt;BR /&gt;
I want to create a block similar to that shown above.&lt;BR /&gt;
In the two quadrants indicated by "+", I would like to create a solid *associative* hatch.&lt;BR /&gt;
I would like to create the block using **only** the two center lines, the circle, and the two&lt;BR /&gt;
hatches.  Is this possible?&lt;BR /&gt;
&lt;BR /&gt;
Is it possible to append an outer loop *without* creating an additional polyline boundary object?&lt;BR /&gt;
&lt;BR /&gt;
IOW, if I created the block 'normally', I would draw the lines, the circle, then use the bhatch&lt;BR /&gt;
command (set to associative), and pick inside the quadrant for each hatch.  The bhatch command&lt;BR /&gt;
evaluates which parts of the existing circle and lines form the hatch's boundary and then creates an&lt;BR /&gt;
*associative* hatch, which can be later be modified (to some extent) by changing the size of the&lt;BR /&gt;
circle or moving the lines.&lt;BR /&gt;
&lt;BR /&gt;
Can the same thing be done using VBA?</description>
      <pubDate>Fri, 11 Feb 2000 17:05:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313624#M95783</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-02-11T17:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: R14 AddHatchMethod Question</title>
      <link>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313625#M95784</link>
      <description>Nice line art David &lt;G&gt;. It's "supposed" to be a target symbol, right?! Why&lt;BR /&gt;
don't you just make a _small_ .jpg of the actual AutoCAD screen, and attach&lt;BR /&gt;
the image to an HTML formatted post?&lt;BR /&gt;
&lt;BR /&gt;
Sorry, I can't help on the actual question, never messed with that yet. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
R. Robert Bell, MCSE&lt;BR /&gt;
Network Administrator (or, Modern-day Wizard)&lt;BR /&gt;
(remove the "not." in my address for direct e-mail)&lt;/G&gt;</description>
      <pubDate>Fri, 11 Feb 2000 18:10:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313625#M95784</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-02-11T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313626#M95785</link>
      <description>Hola Robert,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it's a target block.  Hope it showed up ok.  (I *hope* it was sent as plain text)&lt;BR /&gt;
I just don't like attaching extra html stuff to my messages, if I can avoid it.&lt;BR /&gt;
&lt;BR /&gt;
If this will help anyone get to the bottom of the matter, here's the VB code I've tried so far...&lt;BR /&gt;
&lt;BR /&gt;
-----------------------------------&lt;BR /&gt;
Sub Make_FSE_Target_Block()&lt;BR /&gt;
    ' This subroutine creates an FSE_Target Block.&lt;BR /&gt;
    ' Create block&lt;BR /&gt;
    Dim BlockObj As AcadBlock&lt;BR /&gt;
    Dim InsPt(0 To 2) As Double&lt;BR /&gt;
    InsPt(0) = 0#: InsPt(1) = 0#: InsPt(2) = 0#&lt;BR /&gt;
    Set BlockObj = ThisDrawing.Blocks.Add(InsPt, "FSE_Target")&lt;BR /&gt;
&lt;BR /&gt;
    ' Add lines to block&lt;BR /&gt;
    Dim LineObj(0 To 1) As AcadLine&lt;BR /&gt;
    Dim LineType As AcadLineType&lt;BR /&gt;
    Dim StartPt(0 To 2) As Double&lt;BR /&gt;
    Dim EndPt(0 To 2) As Double&lt;BR /&gt;
    StartPt(0) = -12#: StartPt(1) = 0#: StartPt(2) = 0#&lt;BR /&gt;
    EndPt(0) = 12#: EndPt(1) = 0#: EndPt(2) = 0#&lt;BR /&gt;
    Set LineObj(0) = BlockObj.AddLine(StartPt, EndPt)&lt;BR /&gt;
    LineObj(0).Color = acByBlock&lt;BR /&gt;
    LineObj(0).LineType = "BYBLOCK"&lt;BR /&gt;
    LineObj(0).Layer = "0"&lt;BR /&gt;
    StartPt(0) = 0#: StartPt(1) = -12#: StartPt(2) = 0#&lt;BR /&gt;
    EndPt(0) = 0#: EndPt(1) = 12#: EndPt(2) = 0#&lt;BR /&gt;
    Set LineObj(1) = BlockObj.AddLine(StartPt, EndPt)&lt;BR /&gt;
    LineObj(1).Color = acByBlock&lt;BR /&gt;
    LineObj(1).LineType = "BYBLOCK"&lt;BR /&gt;
    LineObj(1).Layer = "0"&lt;BR /&gt;
&lt;BR /&gt;
    ' Add circle to block&lt;BR /&gt;
    Dim CircleObj As AcadCircle&lt;BR /&gt;
    Dim CenterPt(0 To 2) As Double&lt;BR /&gt;
    Dim Radius As Double&lt;BR /&gt;
    CenterPt(0) = 0#: CenterPt(1) = 0#: CenterPt(2) = 0#&lt;BR /&gt;
    Radius = 6#&lt;BR /&gt;
    Set CircleObj = BlockObj.AddCircle(CenterPt, Radius)&lt;BR /&gt;
    CircleObj.Color = acByLayer&lt;BR /&gt;
    CircleObj.LineType = "BYBLOCK"&lt;BR /&gt;
    CircleObj.Layer = "0"&lt;BR /&gt;
&lt;BR /&gt;
    ' Add lwplines to block&lt;BR /&gt;
    Dim LoopObj(0 To 1) As Object&lt;BR /&gt;
    Dim VertPts1(0 To 8) As Double&lt;BR /&gt;
    VertPts1(0) = 0#: VertPts1(1) = 0#: VertPts1(2) = 0#&lt;BR /&gt;
    VertPts1(3) = 0#: VertPts1(4) = 6#: VertPts1(5) = 0#&lt;BR /&gt;
    VertPts1(6) = -6#: VertPts1(7) = 0#: VertPts1(8) = 0#&lt;BR /&gt;
    Set LoopObj(0) = BlockObj.AddPolyline(VertPts1)&lt;BR /&gt;
    LoopObj(0).Color = acByLayer&lt;BR /&gt;
    LoopObj(0).LineType = "BYLAYER"&lt;BR /&gt;
    LoopObj(0).Layer = "DEFPOINTS"&lt;BR /&gt;
    ' Change the bulge of the 1st segment&lt;BR /&gt;
    LoopObj(0).SetBulge 1, Sqr(2) - 1&lt;BR /&gt;
    LoopObj(0).Closed = True&lt;BR /&gt;
    LoopObj(0).Update&lt;BR /&gt;
&lt;BR /&gt;
    Dim VertPts2(0 To 8) As Double&lt;BR /&gt;
    VertPts2(0) = 0#: VertPts2(1) = 0#: VertPts2(2) = 0#&lt;BR /&gt;
    VertPts2(3) = 0#: VertPts2(4) = -6#: VertPts2(5) = 0#&lt;BR /&gt;
    VertPts2(6) = 6#: VertPts2(7) = 0#: VertPts2(8) = 0#&lt;BR /&gt;
    Set LoopObj(1) = BlockObj.AddPolyline(VertPts2)&lt;BR /&gt;
    LoopObj(1).Color = acByLayer&lt;BR /&gt;
    LoopObj(1).LineType = "BYLAYER"&lt;BR /&gt;
    LoopObj(1).Layer = "DEFPOINTS"&lt;BR /&gt;
    ' Change the bulge of the 1st segment&lt;BR /&gt;
    LoopObj(1).SetBulge 1, Sqr(2) - 1&lt;BR /&gt;
    LoopObj(1).Closed = True&lt;BR /&gt;
    LoopObj(1).Update&lt;BR /&gt;
&lt;BR /&gt;
    ' Add SolidHatches to block&lt;BR /&gt;
    Dim HatchObj As AcadHatch&lt;BR /&gt;
    Set HatchObj = BlockObj.AddHatch(acHatchPatternTypePreDefined, "SOLID", True)&lt;BR /&gt;
    HatchObj.AppendOuterLoop (LoopObj)&lt;BR /&gt;
    HatchObj.Color = acByLayer&lt;BR /&gt;
    HatchObj.LineType = "BYBLOCK"&lt;BR /&gt;
    HatchObj.Layer = "0"&lt;BR /&gt;
    HatchObj.Evaluate&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
-----------------------------------&lt;BR /&gt;
&lt;BR /&gt;
This makes the block OK, w/ associative hatch, even.&lt;BR /&gt;
But it's those two loop objects I'd like to get rid of (while keeping the associative hatch)...&lt;BR /&gt;
&lt;BR /&gt;
Here's a smaller associative hatch example (with 3 objects comprising the loop array):&lt;BR /&gt;
&lt;BR /&gt;
-----------------------------------&lt;BR /&gt;
Sub MakeHatch()&lt;BR /&gt;
&lt;BR /&gt;
    Dim PIdiv2&lt;BR /&gt;
    PIdiv2 = 2 * Atn(1)&lt;BR /&gt;
    Dim HatchObj1 As AcadHatch&lt;BR /&gt;
    Set HatchObj1 = ThisDrawing.ModelSpace.AddHatch(acHatchPatternTypePreDefined, "SOLID", True)&lt;BR /&gt;
    Dim LoopObj(0 To 2) As Object&lt;BR /&gt;
    Dim CenterPt(0 To 2) As Double&lt;BR /&gt;
    CenterPt(0) = 0#: CenterPt(1) = 0#: CenterPt(2) = 0#&lt;BR /&gt;
    Dim Radius As Double&lt;BR /&gt;
    Radius = 6#&lt;BR /&gt;
    Set LoopObj(0) = ModelSpace.AddArc(CenterPt, Radius, PIdiv2, 2 * PIdiv2)&lt;BR /&gt;
    Set LoopObj(1) = ModelSpace.AddLine(LoopObj(0).EndPoint, CenterPt)&lt;BR /&gt;
    Set LoopObj(2) = ModelSpace.AddLine(CenterPt, LoopObj(0).StartPoint)&lt;BR /&gt;
    HatchObj1.AppendOuterLoop (LoopObj)&lt;BR /&gt;
    HatchObj1.Color = acByLayer&lt;BR /&gt;
    HatchObj1.LineType = "BYBLOCK"&lt;BR /&gt;
    HatchObj1.Layer = "0"&lt;BR /&gt;
    HatchObj1.Evaluate&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
-----------------------------------&lt;BR /&gt;
&lt;BR /&gt;
OK, now I'll be opening a can o' worms but...&lt;BR /&gt;
This has been my *very* *first* serious try at using VBA (for anything worthwhile).&lt;BR /&gt;
So, please, anyone, is it just me, or is there a better way to make any of the above code more&lt;BR /&gt;
efficient?  Having become accustomed to using AutoLISP, I must say that I'm rather dissappointed.  I&lt;BR /&gt;
mean, using object properties and methods are rather cool, but those arrays are the *pits*, IMO -&lt;BR /&gt;
lists are sooo much nicer (and compact) for this sort of thing.  Or am I missing the [dim point(0 to&lt;BR /&gt;
2) as Double] here?  Though the Subroutine text itself is still fairly small, the .dvb created from&lt;BR /&gt;
it is ~54KB! (about twice as big at the .dwg file itself!)&lt;BR /&gt;
&lt;BR /&gt;
My hope was to make those blocks a bit quicker and more efficiently with code, but I seem to be&lt;BR /&gt;
going in the opposite direction here.  Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
And now a question for the Delphi programmers out there...&lt;BR /&gt;
After much head scratching, reading, and more head scratching, I was able to *finally* get Delphi 4&lt;BR /&gt;
to make an .exe that draws a circle in R14.01.  (HURRAH!)  (**Muchas gracias** for your example&lt;BR /&gt;
pages, Tony, it was a *big* help, once I got things sorted out a bit more).  I haven't done more&lt;BR /&gt;
yet, (having had to stop, rest, and bask in the glory of it all &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; ) but I hope to.  Since I'm just&lt;BR /&gt;
starting out here with both Delphi and VBA and this OOP AutoCAD stuff, I'm frankly not understanding&lt;BR /&gt;
a whole lot yet.&lt;BR /&gt;
&lt;BR /&gt;
But my Delphi question is this...  Although the .pas form file itself was only 2KB, the .exe file&lt;BR /&gt;
created from the project to draw the circle (only) was a whopping 296KB!!! &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;  Is there another way&lt;BR /&gt;
to do this without making an .exe?  (Or by using a much smaller one?)  Am I correct in understanding&lt;BR /&gt;
that the AutoCAD_TLB.pas (and Tony's AcConst.pas) need to be added to the uses clause?  (I couldn't&lt;BR /&gt;
get the .exe to work without them.)  Here's the Delphi code I used:&lt;BR /&gt;
&lt;BR /&gt;
---------------------------------&lt;BR /&gt;
unit AcadForm;&lt;BR /&gt;
&lt;BR /&gt;
interface&lt;BR /&gt;
&lt;BR /&gt;
uses&lt;BR /&gt;
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,&lt;BR /&gt;
  StdCtrls, AutoCAD_TLB, AcConst;&lt;BR /&gt;
&lt;BR /&gt;
type&lt;BR /&gt;
  TForm1 = class(TForm)&lt;BR /&gt;
    Button1: TButton;&lt;BR /&gt;
    procedure Button1Click(Sender: TObject);&lt;BR /&gt;
  private&lt;BR /&gt;
    { Private declarations }&lt;BR /&gt;
  public&lt;BR /&gt;
    { Public declarations }&lt;BR /&gt;
  end;&lt;BR /&gt;
&lt;BR /&gt;
var&lt;BR /&gt;
  Form1: TForm1;&lt;BR /&gt;
&lt;BR /&gt;
implementation&lt;BR /&gt;
&lt;BR /&gt;
{$R *.DFM}&lt;BR /&gt;
&lt;BR /&gt;
uses&lt;BR /&gt;
  ComObj, ActiveX;&lt;BR /&gt;
&lt;BR /&gt;
procedure TForm1.Button1Click(Sender: TObject);&lt;BR /&gt;
var&lt;BR /&gt;
  Acad, Circle, vPoint, Mspace : OleVariant;&lt;BR /&gt;
&lt;BR /&gt;
begin&lt;BR /&gt;
  // Get the AutoCAD application object&lt;BR /&gt;
  Acad := GetActiveOleObject('AutoCAD.Application.14');&lt;BR /&gt;
  // Create the point array and assign values to it&lt;BR /&gt;
  vPoint := VarArrayCreate([0,2], varDouble);&lt;BR /&gt;
  vPoint[0] := 2.0;&lt;BR /&gt;
  vPoint[1] := 6.0;&lt;BR /&gt;
  vPoint[2] := 0.0;&lt;BR /&gt;
  // Get the ActiveDocument's model space object&lt;BR /&gt;
  Mspace := Acad.ActiveDocument.Modelspace;&lt;BR /&gt;
  // call the AddCircle() method to create the&lt;BR /&gt;
  // circle with a radius of 10 units:&lt;BR /&gt;
  Circle := Mspace.AddCircle(Vpoint, 10.0);&lt;BR /&gt;
  // Update the circle&lt;BR /&gt;
  Circle.Update;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
end.&lt;BR /&gt;
---------------------------------&lt;BR /&gt;
&lt;BR /&gt;
I see some arrays again &lt;SIGH&gt;, but at least its coding looks (a little) more efficient than vb.&lt;BR /&gt;
&lt;BR /&gt;
Just am trying to get a feel for the water here.  I sure wish the AutoCAD Automation Reference Help&lt;BR /&gt;
provided more in the way of Delphi examples (my biggest obstacle to using Delphi with AutoCAD, it&lt;BR /&gt;
appears.)&lt;BR /&gt;
&lt;BR /&gt;
Well, sorry for the newbie rambling, but I'm just trying to get my head wrapped around this stuff.&lt;BR /&gt;
&lt;BR /&gt;
Any responses relating to these queries would be most appreciated...&lt;BR /&gt;
&lt;BR /&gt;
Best regards,&lt;BR /&gt;
David Kozina&lt;BR /&gt;
&lt;BR /&gt;
R. Robert Bell &lt;NOT.ROBERTB&gt; wrote in message&lt;BR /&gt;
news:881jc8$5kn5@adesknews2.autodesk.com...&lt;BR /&gt;
&amp;gt; Nice line art David &lt;G&gt;. It's "supposed" to be a target symbol, right?! Why&lt;BR /&gt;
&amp;gt; don't you just make a _small_ .jpg of the actual AutoCAD screen, and attach&lt;BR /&gt;
&amp;gt; the image to an HTML formatted post?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sorry, I can't help on the actual question, never messed with that yet. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/G&gt;&lt;/NOT.ROBERTB&gt;&lt;/SIGH&gt;</description>
      <pubDate>Fri, 11 Feb 2000 19:22:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313626#M95785</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-02-11T19:22:54Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313627#M95786</link>
      <description>So, then,&lt;BR /&gt;
&lt;BR /&gt;
I am to assume that from the paucity of constructive criticism from those expert VB programmers out&lt;BR /&gt;
there, my previous posted subroutine is as good as it gets in R14.01 VBA?  Or is there a more&lt;BR /&gt;
elegant VB code solution?&lt;BR /&gt;
&lt;BR /&gt;
I must say that if the VB code I posted was elegant, then I'm purty scared.&lt;BR /&gt;
&lt;BR /&gt;
Please, please, everyone, no shoving or crowding in line so as to answer my question.&lt;BR /&gt;
&lt;BR /&gt;
Sorry for the sarcasm,&lt;BR /&gt;
TPUQ "The Propounder of Unanswerable Queries"</description>
      <pubDate>Mon, 14 Feb 2000 17:56:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/r14-addhatchmethod-question/m-p/313627#M95786</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-02-14T17:56:23Z</dc:date>
    </item>
  </channel>
</rss>

