abra-CAD-abra Posted June 11, 2020 Posted June 11, 2020 (edited) All, setpropertyvalue I am trying to use the above function to manipulate viewport overrides for layers. It works as expected with the following layer property names: "ColorOverride" "IsFrozenInCurrentViewport" "TransparencyOverride" However, I cannot successfully apply values to the layer property names below: "LineWeightOverride" "LinetypeObjectIdOverride" I am able to successfully retrieve values for the above using the getpropertyvalue function but I cannot apply properties. Examples: (setpropertyvalue (tblobjname "LAYER" "TEST-LAYER") "LinetypeObjectIdOverride" "BORDER")) returns: "error: ADS request error" (setpropertyvalue (tblobjname "LAYER" "TEST-LAYER") "LineWeightOverride" 15) returns: "Lineweight rounded to nearest valid value of 2.11 mm" It works as expected only for values of 0 and 1. All other valid lineweight values are either rounded up to 2.11 or down to 0.0. For example, it will not accept 13 or 1.3. Can anybody shed any light? Any guidance would be much appreciated. Cheers.. Edited June 11, 2020 by abra-CAD-abra Quote
dlanorh Posted June 11, 2020 Posted June 11, 2020 9 hours ago, abra-CAD-abra said: All, setpropertyvalue I am trying to use the above function to manipulate viewport overrides for layers. It works as expected with the following layer property names: "ColorOverride" "IsFrozenInCurrentViewport" "TransparencyOverride" However, I cannot successfully apply values to the layer property names below: "LineWeightOverride" "LinetypeObjectIdOverride" I am able to successfully retrieve values for the above using the getpropertyvalue function but I cannot apply properties. Examples: (setpropertyvalue (tblobjname "LAYER" "TEST-LAYER") "LinetypeObjectIdOverride" "BORDER")) returns: "error: ADS request error" (setpropertyvalue (tblobjname "LAYER" "TEST-LAYER") "LineWeightOverride" 15) returns: "Lineweight rounded to nearest valid value of 2.11 mm" It works as expected only for values of 0 and 1. All other valid lineweight values are either rounded up to 2.11 or down to 0.0. For example, it will not accept 13 or 1.3. Can anybody shed any light? Any guidance would be much appreciated. Cheers.. You are value you are supplying is incorrect When you (dumpallproperties) you get LineWeight (type: AcDb::LineWeight) (LocalName: Lineweight) = -3 LineWeightOverride (type: AcDb::LineWeight) (LocalName: Viewport Lineweight) = Failed to get value and LinetypeObjectId (type: AcDbObjectId) (LocalName: Linetype) = 7ffff603960 LinetypeObjectIdOverride (type: AcDbObjectId) (LocalName: Viewport Linetype) = Failed to get value "Border" is a linetype "name" NOT an objectID and I suspect that the same is true for lineweight accepted Lineweight constants acLnWtByLayer acLnWtByBlock acLnWtByLwDefault acLnWt000 acLnWt005 acLnWt009 acLnWt013 acLnWt015 acLnWt018 acLnWt020 acLnWt025 acLnWt030 acLnWt035 acLnWt040 acLnWt050 acLnWt053 acLnWt060 acLnWt070 acLnWt080 acLnWt090 acLnWt100 acLnWt106 acLnWt120 acLnWt140 acLnWt158 acLnWt200 acLnWt211 Quote
BIGAL Posted June 12, 2020 Posted June 12, 2020 Dlanorh had a similar problem, can see the mixture of numbers, strings and known names. (vlax-for ent block (vla-put-color ent 0) (vla-put-linetype ent "Bylayer") (vla-put-lineweight ent aclnwtbyblock) ) Quote
abra-CAD-abra Posted June 12, 2020 Author Posted June 12, 2020 Guys, thank you for your responses. When I dump all properties for Layer "0" inside an active viewport, it returns the following: LineWeightOverride (type: AcDb::LineWeight) (LocalName: Viewport Lineweight) = 100 LinetypeObjectIdOverride (type: AcDbObjectId) (LocalName: Viewport Linetype) = 216decd3960 The return value for the LineWeightOverride property is 100 which is 1.00mm. Similarly; (getpropertyvalue (tblobjname "LAYER" "0") "LineWeightOverride" 1) returns 100. If the VP Lineweight was 1.3mm it would return 13. I cannot assign a value of 13 using: (setpropertyvalue (tblobjname "LAYER" "0") "LineWeightOverride" 13) It returns "Lineweight rounded to nearest valid value of 2.11 mm" For LinetypeObjectIdOverride: I can retrieve the name of the linetype using: (setq val (getpropertyvalue (tblobjname "LAYER" "0") "LinetypeObjectIdOverride")) (setq ltn (getpropertyvalue val "Name")) This returns "Continuous" However, I cannot set this value using: (setpropertyvalue (tblobjname "LAYER" "0") "LinetypeObjectIdOverride" "Border") 15 hours ago, dlanorh said: "Border" is a linetype "name" NOT an objectID How do I access the objectID? The arguments for setpropertyvalue are as follows: (setpropertyvalue ename propertyname value [or collectionName index name val]) 4 hours ago, BIGAL said: Dlanorh had a similar problem, can see the mixture of numbers, strings and known names. (vlax-for ent block (vla-put-color ent 0) (vla-put-linetype ent "Bylayer") (vla-put-lineweight ent aclnwtbyblock) ) BIGAL, the above vla-put functions don't work for vieweport overrides. You would expect those functions to cater for all. Quote
marko_ribar Posted June 12, 2020 Posted June 12, 2020 Have you tried : (setq val (getpropertyvalue (tblobjname "LAYER" "0") "LinetypeObjectIdOverride")) (setpropertyvalue val "Name" "Border") Quote
dlanorh Posted June 12, 2020 Posted June 12, 2020 I have to ask this, but I hope you are trying to run viewport overrides whilst looking at modelspace through an active paperspace viewport. Quote
abra-CAD-abra Posted June 14, 2020 Author Posted June 14, 2020 On 6/12/2020 at 4:30 PM, marko_ribar said: Have you tried : (setq val (getpropertyvalue (tblobjname "LAYER" "0") "LinetypeObjectIdOverride")) (setpropertyvalue val "Name" "Border") Yes. This also returns: ADS request error On 6/13/2020 at 7:41 AM, dlanorh said: I have to ask this, but I hope you are trying to run viewport overrides whilst looking at modelspace through an active paperspace viewport. Yes 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.