Jump to content

Hatch Inherit Properties


Dj_T_Rex2002

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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