Jump to content

Recommended Posts

Posted

The attached piece of hatch set the transparency as 30%.  What is the code for 10% transparency.  I have tried to work it out using AI but when I ask for 10% it gives a transparency of 86%.

(entmod (append (entget (tblobjname "layer" lay)) '((-3("AcCmTransparency" (1071 . 33554610))))))

 

Posted (edited)

Hey @andyb57J,

 

I don't have an answer for value of 10% or either for the value "33554610" which present the 30%, why is it so. I know this is for the Hatching closed polylines from your last topic where I helped you, but I have question: Do you need a transparency for the layer or for the hatch?

 

There is a system variable HPTRANSPARENCY which is meant for sets the default transparency for new hatches and fills in the current drawing.

 

The basic formula for calculating percents for hatching is: ((percent/100) * 90). So, if you want a 10% transparency, when use HPTRANSPARENCY you need to put 9. This will set for all new hatches to be at 10% of transparency.

 

If you need the layer transparency, then replace the next code to avoid that number "33554610" with:

;; OLD
(setq lay (strcat "SHG_Hatch_(FD)_" layx))
(command "layer" "new" lay "")
(command "layer" "color" "truecolor" col lay "")
(command "LAYER" "SET" lay "")
(command "color" "bylayer")
(entmod (append (entget (tblobjname "layer" lay)) '((-3("AcCmTransparency" (1071 . 33554610))))))

;; NEW
(setq lay (strcat "SHG_Hatch_(FD)_" layx))
(command "layer" "new" lay "")
(command "layer" "color" "truecolor" col lay "")
(command "LAYER" "SET" lay "")
(command "color" "bylayer")
(command "layer" "tr" 9 lay "")

 

Best regards

Edited by Saxlle
Posted
2 hours ago, Saxlle said:

Hey @andyb57J,

 

I don't have an answer for value of 10% or either for the value "33554610" which present the 30%, why is it so. I know this is for the Hatching closed polylines from your last topic where I helped you, but I have question: Do you need a transparency for the layer or for the hatch?

 

There is a system variable HPTRANSPARENCY which is meant for sets the default transparency for new hatches and fills in the current drawing.

 

The basic formula for calculating percents for hatching is: ((percent/100) * 90). So, if you want a 10% transparency, when use HPTRANSPARENCY you need to put 9. This will set for all new hatches to be at 10% of transparency.

 

If you need the layer transparency, then replace the next code to avoid that number "33554610" with:

;; OLD
(setq lay (strcat "SHG_Hatch_(FD)_" layx))
(command "layer" "new" lay "")
(command "layer" "color" "truecolor" col lay "")
(command "LAYER" "SET" lay "")
(command "color" "bylayer")
(entmod (append (entget (tblobjname "layer" lay)) '((-3("AcCmTransparency" (1071 . 33554610))))))

;; NEW
(setq lay (strcat "SHG_Hatch_(FD)_" layx))
(command "layer" "new" lay "")
(command "layer" "color" "truecolor" col lay "")
(command "LAYER" "SET" lay "")
(command "color" "bylayer")
(command "layer" "tr" 9 lay "")

 

Best regards

The transparency is for the hatch but in each case the hatch is on its layer.  The new code works perfect except "tr" 9 gives me a 9% transparency.  10 is 10% , 30 is 30% etc.

 

image.thumb.png.62b91d51fb3bea1f79ca37bd9c9733c2.png

 

Agai thankyou for everything.

Posted (edited)

No no, just to clarify. If you want to 10% of transparency you will need to enter 9 ((10/100) * 90), where the 10 is the desired percentage which you want and the 90 is the total amount of transparency which can be inputed. The 90 is equal to 100%.

Edited by Saxlle
Posted

@andyb57J Another way to get the value is to set the transparency to what you want on layer 0 then dump the properties:

(entget (TBLOBJNAME "layer" "0") '("*"))
;; 10% transparency
;; ("AcCmTransparency" (1071 . 33554661))


 

Posted
11 hours ago, Saxlle said:

No no, just to clarify. If you want to 10% of transparency you will need to enter 9 ((10/100) * 90), where the 10 is the desired percentage which you want and the 90 is the total amount of transparency which can be inputed. The 90 is equal to 100%.

Ok sorry I now understand your code.  if I want 10% transparency the value is 9.  I was thinking that the value was actually the percentage i.e. 9 was 9% and 10 was 10%.

 

I would have a lot of difficulty in getting other users to familiarize with this so Ill will just use the values rather then a percentage.

 

Thankyou again.  

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