Jump to content

alanjt's Misc. Useful Lisp Routines


alanjt

Recommended Posts

Works fine for me. :huh:

 

Paste the following code into ACad, select one of the hatch objects, copy and paste the return here.

 

(vlax-dump-object (vlax-ename->vla-object (car (entsel))) T)

 

Here is what I get now.

 

Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T)
Select object: ; IAcadHatch: AutoCAD Hatch Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00afa5fc>
;   AssociativeHatch = 0
;   Document (RO) = #<VLA-OBJECT IAcadDocument 010fdd50>
;   Elevation = 0.0
;   GradientAngle = 0.0
;   GradientCentered = -1
;   GradientColor1 = Exception occurred
;   GradientColor2 = Exception occurred
;   GradientName = ""
;   Handle (RO) = "28C"
;   HasExtensionDictionary (RO) = 0
;   HatchObjectType = 0
;   HatchStyle = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 029f5574>
;   ISOPenWidth = 100
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   NumberOfLoops (RO) = 1
;   ObjectID (RO) = 2130071584
;   ObjectName (RO) = "AcDbHatch"
;   OwnerID (RO) = 2130025720
;   PatternAngle = 0.0
;   PatternDouble = 0
;   PatternName (RO) = "ANSI31"
;   PatternScale = 1.0
;   PatternSpace = 1.0
;   PatternType (RO) = 1
;   PlotStyleName = "ByLayer"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 029f5b50>
;   Visible = -1
; Methods supported:
;   AppendInnerLoop (1)
;   AppendOuterLoop (1)
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   Evaluate ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetLoopAt (2)
;   GetXData (3)
;   Highlight (1)
;   InsertLoopAt (3)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetPattern (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()
T

Link to comment
Share on other sites

That's beyond strange. All hatch objects have the Area value.

Select object: ; IAcadHatch: AutoCAD Hatch Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00cbef78>
[color=Red];   Area (RO) = 37.7825[/color]
;   AssociativeHatch = -1
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0161fb60>
;   Elevation = 0.0

As with any problem, did you restart Autocad and/or restart your computer?

 

If you List the hatch, does it give you an area?

Link to comment
Share on other sites

I just opened CAD and started a new drawing as what you see just to test the routine.

 

When I run list, This is what I get.

 

Command: LIST
Select objects: 1 found
Select objects:
                 HATCH     Layer: "0"
                           Space: Model space
                  Handle = 28E
                Hatch pattern ANSI31
                Hatch scale    1.0000
                Hatch angle      0
                Associative

Link to comment
Share on other sites

Just to mention.

 

I just ran the program in two different versions of CAD (2004 & 2009) and get the same results.

Link to comment
Share on other sites

If I use the AREA command by selecting the HATCH direct with object It gives me this:

 

Command: AREA
Specify first corner point or [Object/Add/Subtract]: O
Select objects:
Selected object does not have an area
Select objects:

Link to comment
Share on other sites

I did before and made another drawing for the benifit of the doubt.

 

Just to mention from the acad help file for properties of hatch.

It does not mention AREA anywhere in the properties.

 

Displays the properties of the selected hatch pattern. 
Property name
(by category) 

Description 
Pattern 

Type 
Specifies the pattern type used for the hatch 
Pattern name 
Specifies the hatch pattern name 
Angle 
Specifies the pattern angle of the hatch: HPANG system variable 
Scale 
Specifies the pattern scale of the hatch: HPSCALE system variable 
Spacing 
Specifies the pattern spacing of the hatch: HPSPACE system variable 
ISO pen width 
Specifies the ISO pen width of an ISO hatch pattern; the first ten values represent the pen width in hundredths of a millimeter 
Double 
Determines whether the hatch pattern is double or not: HPDOUBLE system variable 
Misc 

Elevation 
Specifies the current elevation (the Z value) of the hatch 
Associative 
Determines whether the hatch is associative or not; an associative hatch is updated when its boundaries are modified 

Link to comment
Share on other sites

Thats what I thought originally, But I figured you found another way around this since it was filtering the rectangle out.

Link to comment
Share on other sites

Thats what I thought originally, But I figured you found another way around this since it was filtering the rectangle out.

The area is extracted from the hatch object itself. The surrounding linework isn't needed. I really don't have a clue on this one. It works on my home and work machine, Lee's computer and works accordingly as tested over at theswamp. This is one of those times when I wish I could sit down at your computer.

Link to comment
Share on other sites

I know I already asked this, but are you certain that you tested it on the three hatched closed PLlines in posted DWG?

Link to comment
Share on other sites

Yes and I made an additional drawing with one hatch with a rectangle as well. The same problem exists in both drawings. I also tested this on two versions of acad as previously mentioned (2004 & 2009).

Link to comment
Share on other sites

I also check for any associated variable that might conflict with the program, But I came up with nothing. I just wanted to cover anything I may have missed.

Link to comment
Share on other sites

I also check for any associated variable that might conflict with the program, But I came up with nothing. I just wanted to cover anything I may have missed.

Punt.

Can you test on another's machine? I assume you are at work.

Link to comment
Share on other sites

Ok,

 

Just tested on my laptop. I made a simple drawing with a hatch. I ran the program and I get the same issue. It will not report back the AREA.

Link to comment
Share on other sites

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...