Jump to content
Dj_T_Rex2002

Hatch Inherit Properties

Recommended Posts

Dj_T_Rex2002

Hi, I was just wondering if there is a button or command to set Hatch Inherit Properties? I don't want to do the whole Match Properties because that is really tideous if you are dealing with a lot of hatches. Thanks in advance

Share this post


Link to post
Share on other sites
rkmcswain

There is an Inherit Properties button inside of the hatch dialog.

Is that what you want?

Share this post


Link to post
Share on other sites
Dj_T_Rex2002
There is an Inherit Properties button inside of the hatch dialog.

Is that what you want?

 

That is what I'm trying to prevent. I kind of want to see if I can come up with a LISP and when I type "MHP" it matches the hatch properties of whatever hatch I click on. This way I don't have to be clicking on every single hatch and click Inherit Properties and then hatch.

Share this post


Link to post
Share on other sites
Dadgad
Posted (edited)
That is what I'm trying to prevent. I kind of want to see if I can come up with a LISP and when I type "MHP" it matches the hatch properties of whatever hatch I click on. This way I don't have to be clicking on every single hatch and click Inherit Properties and then hatch.

 

If you are unaware, you can specify your favorite HATCH pattern as your default used with the HATCH command, by configuring your HPNAME system variable.

 

You might want to change it somewhat frequently, depending on what you are working on. Maybe at the start of your work day, as you think about what drawings you will be working on throughout the day.

 

I would suggest clicking on INHERIT PROPERTIES first, and the hatch whose properties you want to inherit, then selecting those to which it should be applied, without the need to stop or reselect inherit properties. :|

HPNAME system variable for default hatch selection.jpg

Edited by Dadgad

Share this post


Link to post
Share on other sites
BIGAL
Posted (edited)

Try this before running hatch command pick an existing hatch.

 

(defun c:shat ( / obj )
(while (/= chk "True")
(if ( and (setq obj (vlax-ename->vla-object (car (entsel "pick object"))))
         (= (vla-get-objectname obj) "AcDbHatch")
   )  
(progn 
(setvar 'hpname (vla-get-PatternName obj))
(setq chk "True")
)
(alert "You did not pick a hatch")
)
)
(setq chk "false")
)

Edited by BIGAL

Share this post


Link to post
Share on other sites
Dj_T_Rex2002
Try this before running hatch command pick an existing hatch.

 

(defun c:shat ( / obj )
(while (/= chk "True")
(if ( and (setq obj (vlax-ename->vla-object (car (entsel "pick object"))))
         (= (vla-get-objectname obj) "AcDbHatch")
   )  
(progn 
(setvar 'hpname (vla-get-PatternName obj))
(setq chk "True")
)
(alert "You did not pick a hatch")
)
)
)

 

Thanks for the help BigAl, I tried the code by it did not work.

Share this post


Link to post
Share on other sites
Dj_T_Rex2002
If you are unaware, you can specify your favorite HATCH pattern as your default used with the HATCH command, by configuring your HPNAME system variable.

 

You might want to change it somewhat frequently, depending on what you are working on. Maybe at the start of your work day, as you think about what drawings you will be working on throughout the day.

 

I would suggest clicking on INHERIT PROPERTIES first, and the hatch whose properties you want to inherit, then selecting those to which it should be applied, without the need to stop or reselect inherit properties. :|

 

 

The thing is that we have a lot of hatches with different annotative scales so it would be too many to keep track of. I rather just hit a command like "MH" then select the hatch and it sets it at that scale and type of hatch

Share this post


Link to post
Share on other sites
BIGAL

Changed code to reset the chk value so runs more than once.

Share this post


Link to post
Share on other sites
Dj_T_Rex2002
Changed code to reset the chk value so runs more than once.

 

Awesome, thanks BigAl ... it works great but it doesn't match the scale. It leaves it at 1.000

Share this post


Link to post
Share on other sites
BIGAL

Time for you to have a go look at code above and work out where these fit Hpscale & Patternscale

 

; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140063f10>
;   Area (RO) = 15363.3
;   AssociativeHatch = 0
;   BackgroundColor = #<VLA-OBJECT IAcadAcCmColor 00000000461cfb70>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000002a5d4ee8>
;   Elevation = 0.0
;   EntityTransparency = "ByLayer"
;   GradientAngle = 0.0
;   GradientCentered = -1
;   GradientColor1 = #<VLA-OBJECT IAcadAcCmColor 00000000461d0230>
;   GradientColor2 = #<VLA-OBJECT IAcadAcCmColor 00000000461d2750>
;   GradientName = "LINEAR"
;   Handle (RO) = "12B52"
;   HasExtensionDictionary (RO) = 0
;   HatchObjectType = 0
;   HatchStyle = 1
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000461d1fd8>
;   ISOPenWidth = 100
;   Layer = "DEFAULT"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   NumberOfLoops (RO) = 1
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AcDbHatch"
;   Origin = (0.0 0.0)
;   OwnerID (RO) = 43
;   PatternAngle = 0.0
;   PatternDouble = 0
;   PatternName (RO) = "ANSI31"
;   PatternScale = 1.0
;   PatternSpace = 1.0
;   PatternType (RO) = 1
;   PlotStyleName = "ByLayer"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000461d3050>
;   Visible = -1

Share this post


Link to post
Share on other sites
Dj_T_Rex2002
Time for you to have a go look at code above and work out where these fit Hpscale & Patternscale

 

; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140063f10>
;   Area (RO) = 15363.3
;   AssociativeHatch = 0
;   BackgroundColor = #<VLA-OBJECT IAcadAcCmColor 00000000461cfb70>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000002a5d4ee8>
;   Elevation = 0.0
;   EntityTransparency = "ByLayer"
;   GradientAngle = 0.0
;   GradientCentered = -1
;   GradientColor1 = #<VLA-OBJECT IAcadAcCmColor 00000000461d0230>
;   GradientColor2 = #<VLA-OBJECT IAcadAcCmColor 00000000461d2750>
;   GradientName = "LINEAR"
;   Handle (RO) = "12B52"
;   HasExtensionDictionary (RO) = 0
;   HatchObjectType = 0
;   HatchStyle = 1
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000461d1fd8>
;   ISOPenWidth = 100
;   Layer = "DEFAULT"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   NumberOfLoops (RO) = 1
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AcDbHatch"
;   Origin = (0.0 0.0)
;   OwnerID (RO) = 43
;   PatternAngle = 0.0
;   PatternDouble = 0
;   PatternName (RO) = "ANSI31"
;   PatternScale = 1.0
;   PatternSpace = 1.0
;   PatternType (RO) = 1
;   PlotStyleName = "ByLayer"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000461d3050>
;   Visible = -1

 

 

Yeah I have no clue where they would fit in it haha my lisp knowledge is too basic. I just know how to do little things. I'm still trying to learn the whole coding thing. I will try to work with what you gave me :) thank you

Share this post


Link to post
Share on other sites
BIGAL

Here is a hint (setvar 'hpname (vla-get-PatternName obj)) have a look at the two words I posted add the line and change. If your looking for something else as well then look at the dump to find its name which can be different to its variable name. hpname=Pattername.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×