andyb57J Posted May 16 Posted May 16 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)))))) Quote
Saxlle Posted May 16 Posted May 16 (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 May 16 by Saxlle Quote
andyb57J Posted May 16 Author Posted May 16 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. Agai thankyou for everything. Quote
Saxlle Posted May 16 Posted May 16 (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 May 16 by Saxlle Quote
Steven P Posted May 16 Posted May 16 Try this, you might need to sign up to The Swam https://www.theswamp.org/index.php?topic=52473.msg574001#msg574001 1 Quote
ronjonp Posted May 16 Posted May 16 @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)) Quote
andyb57J Posted May 17 Author Posted May 17 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. Quote
Recommended Posts
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.