Author Topic: Is there an issue with vla-put-lineweight?  (Read 6369 times)

0 Members and 1 Guest are viewing this topic.

nivuahc

  • Guest
Is there an issue with vla-put-lineweight?
« on: April 09, 2008, 02:40:11 PM »
So I've got this list of company standard layers setup like this:

Layer Name, Description, Color, Line Weight, Line Type

So I figured I would copy/paste the layer list, put them in a list and create them on demand using Lisp. Time to scratch some things together. Not having written a line of Lisp in nearly a year, this should be fun.

I've got the routine done, but I noticed a little problem when I ran it. None of the line weights are getting set.

Code: [Select]
(defun test ( / TestLayer)
(setq TestLayer
(vla-add
(vla-get-layers
(vla-get-activedocument
(vlax-get-Acad-Object)
)
)
"LineWeightTest"
)
)
(vla-put-description TestLayer "Testing the setting of a layers lineweight")
(vla-put-color TestLayer 64)
(vla-put-lineweight TestLayer 0.014)
(vla-put-linetype TestLayer "Continuous")
)

The above routine is how I'm attempting to set everything, including the line weight. I don't get any errors, it just sets the line weight at 0.000" no matter what value I use for vla-put-lineweight.

I've searched here and I've tried several different ways to do it but nothing besides manually opening the layer dialog and changing it by hand seems to want to do the trick.

I'm using 2008 MEP and I don't have anything else available to test it on. From everything that I've read, though, this ought to work.

For reference:

Code: [Select]
Command: (vlax-dump-object TestLayer T)
; IAcadLayer: A logical grouping of data, similar to transparent acetate
overlays on a drawing
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00d74d3c>
;   Description = "Testing the setting of a layers lineweight"
;   Document (RO) = #<VLA-OBJECT IAcadDocument 01edf940>
;   Freeze = 0
;   Handle (RO) = "4B8"
;   HasExtensionDictionary (RO) = 0
;   LayerOn = -1
;   Linetype = "Continuous"
;   Lineweight = 0
;   Lock = 0
;   Material = "Global"
;   Name = "LineWeightTest"
;   ObjectID (RO) = 2124158016
;   ObjectName (RO) = "AcDbLayerTableRecord"
;   OwnerID (RO) = 2126400528
;   PlotStyleName = "Color_64"
;   Plottable = -1
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 1222cbd0>
;   Used (RO) = 0
;   ViewportDefault = 0
; Methods supported:
;   Delete ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   SetXData (2)
T

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Is there an issue with vla-put-lineweight?
« Reply #1 on: April 09, 2008, 02:47:48 PM »
The lineweight value must be an integer and it must be a valid value (0.014 is not in the standard list so it will fail even if passed correctly).
Code: [Select]
(vla-put-lineweight lay 14)
; error: Automation Error. Invalid lineweight value

(vla-put-lineweight lay 15)
nil
a return value of nil means it worked....and that layer now has a LW of 0.15

HTH

daron

  • Guest
Re: Is there an issue with vla-put-lineweight?
« Reply #2 on: April 09, 2008, 02:49:25 PM »
Godd to see you back, chuck.

nivuahc

  • Guest
Re: Is there an issue with vla-put-lineweight?
« Reply #3 on: April 09, 2008, 02:57:08 PM »
The lineweight value must be an integer and it must be a valid value (0.014 is not in the standard list so it will fail even if passed correctly).
Code: [Select]
(vla-put-lineweight lay 14)
; error: Automation Error. Invalid lineweight value

(vla-put-lineweight lay 15)
nil
a return value of nil means it worked....and that layer now has a LW of 0.15

HTH


Yes, thank you, that helps tremendously.

According to what I just read on Afralisp valid values are -3 (ByLwDeafault), -2 (ByBlock), -1 (ByLayer), 0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, 211

And 15, for me, works out to be 0.006"

* nivuahc goes to do more digging

* nivuahc waves at Daron

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Is there an issue with vla-put-lineweight?
« Reply #4 on: April 09, 2008, 02:57:44 PM »
Shoot, Jeff beat me to it.
Good to see you Jeff. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

DEVITG

  • Bull Frog
  • Posts: 481
Re: Is there an issue with vla-put-lineweight?
« Reply #5 on: April 09, 2008, 02:59:41 PM »
Look for
vla-put-lineweight at the VLIDE help , and it will show you a lis of some acxxxxxnn ,
you can send it as argument , like when you want to putcolor to 1 you can use acRed .
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Is there an issue with vla-put-lineweight?
« Reply #6 on: April 09, 2008, 03:01:23 PM »
Too slow again.
From the help.
Code: [Select]
Specifies the lineweight of an individual entity or the default lineweight for the drawing.

Signature

object.Lineweight

object All Drawing objects; DatabasePreferences, Layer
The object or objects this property applies to.

Lineweight acLineWeight enum; read-write

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

Remarks

The initial value for this property is acLnWtByBlock.
Lineweight values consist of standard settings including BYLAYER, BYBLOCK, and DEFAULT. The DEFAULT value is set by the LWDEFAULT system variable and defaults to a value of 0.01 in. or 0.25 mm. All new objects and layers have a default setting of DEFAULT. The lineweight value of 0 plots at the thinnest lineweight available on the specified plotting device and is displayed at one pixel wide in model space.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Is there an issue with vla-put-lineweight?
« Reply #7 on: April 09, 2008, 03:23:03 PM »
And 15, for me, works out to be 0.006"
Yes, I forgot to mention that the ActiveX API uses metric for the lineweights, so where I called for 15, that is 0.15mm which = 0.006". To achieve your 0.014" you would need to use 35.