TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: KewlToyZ on June 25, 2008, 01:31:44 PM

Title: vla-put-? how do I list the options available?
Post by: KewlToyZ on June 25, 2008, 01:31:44 PM
I wondered how I could get all the available options for vla-put-, vla-, etc..
Thanks in advanced  :kewl:
More or less I wanted the tree of how the formatting goes and what entities are able to be used.
Title: Re: vla-put-? how do I list the options available?
Post by: T.Willey on June 25, 2008, 01:41:39 PM
I use the help files.  It show almost everything.  I also use these three routines to see what I can do per object.  'dlist2' is for nested object selection.

Code: [Select]
(defun c:dlist (/ ob1)
    (setq ob1 (car (entsel "Select entity:  ")))
    (setq ob2 (vlax-ename->vla-object ob1))
    (textpage)
    (vlax-dump-object ob2 t)
    (princ)
)
(defun c:dlist2 (/ ob1)
    (setq ob1 (car (nentsel "Select entity:  ")))
    (setq ob2 (vlax-ename->vla-object ob1))
    (textpage)
    (vlax-dump-object ob2 t)
    (princ)
)
(defun Dump (VlaObject)
(vlax-dump-object VlaObject t)
)
Title: Re: vla-put-? how do I list the options available?
Post by: KewlToyZ on June 25, 2008, 01:52:22 PM
Thanks Tim, Always better to learn fishing than get handed a fish, in this case thanks for the pole  :kewl:
I found what I was looking for but not sure what the format problem is with my input data.
Bouncing around wondering if it is a data type issue.

Messing with the StandardLayerSetup ;; codehimbelonga kwb@TheSwamp
Added lineweights to it:
(vla-put-lineweight oNewLayer (caddr LayerData)) ;; lineweight not LWeight or linewieght!

Is it the order I have it in?
(vla-put-linetype oNewLayer LtName)
(vla-put-color oNewLayer (caddr LayerData))
(vla-put-lineweight oNewLayer (caddr LayerData))
(vla-put-description oNewLayer (cadddr LayerData))

Then added the lineweight to the list
(list "ST00" "CONTINUOUS" 8 "0.60" "Layer Description ST00")

Tried just 0.60 & .60 with and without quotes and I get the same error:
; error: Automation Error. Invalid lineweight value
Title: Re: vla-put-? how do I list the options available?
Post by: CAB on June 25, 2008, 03:00:34 PM
You are using caddr for both:
Code: [Select]
(vla-put-color oNewLayer (caddr LayerData))
(vla-put-lineweight oNewLayer (caddr LayerData))
Title: Re: vla-put-? how do I list the options available?
Post by: CAB on June 25, 2008, 03:02:15 PM
nth may be slower but less confusing.  8-)
Title: Re: vla-put-? how do I list the options available?
Post by: ronjonp on June 25, 2008, 03:06:29 PM
Use 60 for your lineweight.

Change your lineweight for layer 0 and use the code below to see what values vla-put-lineweight is looking for.

(vlax-ename->vla-object (tblobjname "layer" "0"))
Title: Re: vla-put-? how do I list the options available?
Post by: CAB on June 25, 2008, 03:23:25 PM
For lineweight values read this:
http://www.theswamp.org/index.php?topic=22438.0
Title: Re: vla-put-? how do I list the options available?
Post by: KewlToyZ on June 25, 2008, 03:33:01 PM
Thanks guys,
Ronjon that fed me a hex value: #<VLA-OBJECT IAcadLayer 0d11b864>
For 0.18mm and 60mm so it must be the formatting as well converting the data type or maybe I am just accessing it wrong.

CAB I'll look up the nth reference and give it another go too.
I had noticed that Kerry Browns caddr was written with 3 d's prior to my fiddling: :?
(vla-put-color oNewLayer (caddr LayerData))
    (vla-put-description oNewLayer (cadddr LayerData))

car the first element
cdr all but the first element
cadr the second element
caddr the third element
never saw the cadddr so it had me scratching my head, neat stuff btw.
Title: Re: vla-put-? how do I list the options available?
Post by: ronjonp on June 25, 2008, 03:42:02 PM
Thanks guys,
Ronjon that fed me a hex value: #<VLA-OBJECT IAcadLayer 0d11b864>
For 0.18mm and 60mm so it must be the formatting as well converting the data type or maybe I am just accessing it wrong.

CAB I'll look up the nth reference and give it another go too.
I had noticed that Kerry Browns caddr was written with 3 d's prior to my fiddling: :?
(vla-put-color oNewLayer (caddr LayerData))
    (vla-put-description oNewLayer (cadddr LayerData))

car the first element
cdr all but the first element
cadr the second element
caddr the third element
never saw the cadddr so it had me scratching my head, neat stuff btw.

Just use (vla-get-lineweight (vlax-ename->vla-object (tblobjname "layer" "0"))) to see only the lweight value. If you use the vlide and inspect the Vla-Object, you'll see all the other goodies :-).
Title: Re: vla-put-? how do I list the options available?
Post by: CAB on June 25, 2008, 03:45:07 PM
Code: [Select]
_$ (car (list "ST00" "CONTINUOUS" 8 "0.60" "Layer Description ST00"))
"ST00"
_$ (cadr (list "ST00" "CONTINUOUS" 8 "0.60" "Layer Description ST00"))
"CONTINUOUS"
_$ (caddr (list "ST00" "CONTINUOUS" 8 "0.60" "Layer Description ST00"))
8
_$ (cadddr (list "ST00" "CONTINUOUS" 8 "0.60" "Layer Description ST00"))
"0.60"
_$ (last (list "ST00" "CONTINUOUS" 8 "0.60" "Layer Description ST00"))
"Layer Description ST00"
_$
Title: Re: vla-put-? how do I list the options available?
Post by: KewlToyZ on June 25, 2008, 04:17:32 PM
 :-D Too kewl, you dudes rock as usual!
I had to use 60 for .6 mm since it defaults to metric it was easy.
Thanks for the lessons and the awesome help as always guys!
Code: [Select]
  (foreach LayerData StandardLayerList
    (setq oNewLayer (vla-add iacadlayers (car LayerData))
          LtName    (cadr LayerData)
    )
    (if (not (c:AssertItem iacadlinetypes LtName))
      (vla-load iacadlinetypes ltName lineTypeFile)
    )
    (vla-put-linetype oNewLayer LtName)
    (vla-put-color oNewLayer (nth 2 LayerData))
    (vla-put-lineweight oNewLayer (nth 3 LayerData))
    (vla-put-description oNewLayer (nth 4 LayerData))
    ;(vla-put-linetype oNewLayer LtName)
    ;(vla-put-color oNewLayer (caddr LayerData))
    ;(vla-put-lineweight oNewLayer (cadddr LayerData)) ; already at the 4th level
    ;(vla-put-description oNewLayer (cddddr LayerData)) ; no 5th level go with nth
  )
  (princ)
)
Title: Re: vla-put-? how do I list the options available?
Post by: CAB on June 25, 2008, 04:34:15 PM
You can play with this too:
Code: [Select]
(setq ValuesList (list "ST00" "CONTINUOUS" 8 "60" "Layer Description ST00"))
(mapcar
  '(lambda (prop value)
     (vlax-put-property obj prop value))
   (list 'linetype 'color 'lineweight 'description)
   (cdr ValuesList)
 )
Title: Re: vla-put-? how do I list the options available?
Post by: KewlToyZ on June 25, 2008, 06:28:40 PM
Quote
If you use the vlide and inspect the Vla-Object, you'll see all the other goodies.
I tried it Ronjon, I seldom use VLIDE because it doesn't have line numbers.
If I can get it to feed me syntax keywords like IntelliSense does with C# in Visual Studio I would be one seriously happy camper.
So far I tried duplicating what you described but I'm not getting anything except nil?
I know I am doing the completely wrong steps though.
Just not familiar with the stepping and other interface tidbits of the vlide, always hated the ls_ files it generated and I like my Textpad much better for text editing/searching.

Thanks CAB I was also reading here: http://www.theswamp.org/index.php?topic=19588.0
trying to find the vla-put- for (plot / no plot)
vla-put-plottable wasn't it,
; error: ActiveX Server returned an error: Parameter not optional
tried plot and noplot
Sifting through help files right now too.
Mainly I wanted to access every varation possible for the new layer management systems including noplot & reconcile as well.
Title: Re: vla-put-? how do I list the options available?
Post by: ronjonp on June 25, 2008, 06:39:35 PM
Paste this (vlax-ename->vla-object (tblobjname "layer" "0")) in the vlide, highlight it and use:

You can use this as well to output to the command line (F2):

(vlax-dump-object(vlax-ename->vla-object (tblobjname "layer" "0"))T)

Title: Re: vla-put-? how do I list the options available?
Post by: ronjonp on June 25, 2008, 06:51:26 PM
Quote
If you use the vlide and inspect the Vla-Object, you'll see all the other goodies.

...
trying to find the vla-put- for (plot / no plot)
vla-put-plottable wasn't it,
; error: ActiveX Server returned an error: Parameter not optional
tried plot and noplot
Sifting through help files right now too.
Mainly I wanted to access every varation possible for the new layer management systems including noplot & reconcile as well.

(vla-put-plottable layer :vlax-true or :vlax-false) :-)
Title: Re: vla-put-? how do I list the options available?
Post by: CAB on June 25, 2008, 06:57:24 PM
Here is another way to use VLIDE:
http://www.theswamp.org/index.php?topic=19612.msg242547#msg242547
Title: Re: vla-put-? how do I list the options available?
Post by: Kerry on June 25, 2008, 10:14:30 PM
You can play with this too:
Code: [Select]
(setq ValuesList (list "ST00" "CONTINUOUS" 8 "60" "Layer Description ST00"))
(mapcar
  '(lambda (prop value)
     (vlax-put-property obj prop value))
   (list 'linetype 'color 'lineweight 'description)
   (cdr ValuesList)
 )

Yep, thats pretty economical :-)
Title: Re: vla-put-? how do I list the options available?
Post by: Kerry on June 25, 2008, 10:16:24 PM
Another advantage of looking at the object using
(vlax-dump-object objxx t)
is that you can see the READ ONLY properties listed ... that info saves beating the head against a wall sometimes
Title: Re: vla-put-? how do I list the options available?
Post by: KewlToyZ on June 26, 2008, 11:47:56 AM
Quote
If you use the vlide and inspect the Vla-Object, you'll see all the other goodies.

...
trying to find the vla-put- for (plot / no plot)
vla-put-plottable wasn't it,
; error: ActiveX Server returned an error: Parameter not optional
tried plot and noplot
Sifting through help files right now too.
Mainly I wanted to access every varation possible for the new layer management systems including noplot & reconcile as well.

(vla-put-plottable layer :vlax-true or :vlax-false) :-)

Thanks a lot for getting me into these.
Code: [Select]
Command: (vlax-dump-object(vlax-ename->vla-object (tblobjname "layer" "0"))T)
; IAcadLayer: A logical grouping of data, similar to transparent acetate
overlays on a drawing
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00cbef78>
;   Description = ""
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0158f5d0>
;   Freeze = 0
;   Handle (RO) = "10"
;   HasExtensionDictionary (RO) = -1
;   LayerOn = -1
;   Linetype = "Continuous"
;   Lineweight = -3
;   Lock = 0
;   Material = "Global"
;   Name = "0"
;   ObjectID (RO) = 2129665152
;   ObjectName (RO) = "AcDbLayerTableRecord"
;   OwnerID (RO) = 2129665040
;   PlotStyleName = "Color_7"
;   Plottable = -1
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 0cc17440>
;   Used (RO) = -1
;   ViewportDefault = 0
; Methods supported:
;   Delete ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   SetXData (2)
T
Possibly the fact I used 1 & 0 when it needed a negative. Going to ply with this some more.
Thanks for the new toys!!
Title: Re: vla-put-? how do I list the options available?
Post by: ronjonp on June 26, 2008, 11:56:07 AM
Glad to help :)