Author Topic: [Help] Table Gridlines  (Read 5084 times)

0 Members and 1 Guest are viewing this topic.

nivuahc

  • Guest
[Help] Table Gridlines
« on: January 14, 2010, 04:08:18 PM »
I'm trying to re-create a table style like the one in the attached image. I'm using the one shown to try and figure out what I need to do to get that double-line at the bottom of the header row. So this is where I'm hitting a brick wall:

Code: [Select]
Command: (setq TblObj (vlax-ename->vla-object (car (entsel))))
Select object: #<VLA-OBJECT IAcadTable 0b7bf0e4>

Command: (vla-GetGridLinetype TblObj 0 1 acHorzBottom)
2128841888
I'm not sure what to make of 2128841888 but I'm hoping it's a way of identifying that the bottom gridline of the selected cell is a double-line. So I check the cell just below it:

Code: [Select]
Command: (vla-GetGridLinetype TblObj 1 1 acHorzBottom)
2128841896

Command: (vla-GetGridLinetype TblObj 1 1 acHorzTop)
2128841888

The bottom line throws out a completely different number and the top line throws out the same number as the bottom line in the cell above (like I would expect). Just for the record, I checked the Left and Right lines in this cell as well as a couple of others, all of them returning 2128841896 (which I'm guessing is a single line).

So I try the following:

Code: [Select]
Command: (vlax-put-property TblObj "SetGridLinetype" 2 1 acHorzBottom 2128841888)
; error: ActiveX Server returned an error: Type mismatch

Okay... what am I missing here?

EDIT: See below (i.e. I'm an idiot)
« Last Edit: January 14, 2010, 04:29:32 PM by nivuahc »

nivuahc

  • Guest
Re: [Help] Table Gridlines
« Reply #1 on: January 14, 2010, 04:10:08 PM »
You know... I hate it when I ask a question, only to realize that it's a PEBKAC error after it's posted  :ugly:

EDIT: and still...

Code: [Select]
Command: (vla-SetGridLinetype TblObj 2 1 acHorzBottom 2128841888)
nil

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: [Help] Table Gridlines
« Reply #2 on: January 14, 2010, 04:21:14 PM »
The integer is the enum for the Table line type, symbols like "acHorzBottom" will evaluate to such enum's also, but getting the symbol for the enum is something I would like to know also.

EDIT:  Perhaps use MP's Atoms.vlx to browse the symbols

T.Willey

  • Needs a day job
  • Posts: 5251
Re: [Help] Table Gridlines
« Reply #3 on: January 14, 2010, 04:24:38 PM »
A nil with ActiveX doesn't mean that it didn't work.  You might have to regen after the code to see if it worked, or you could try the Update method on the table.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: [Help] Table Gridlines
« Reply #4 on: January 14, 2010, 04:27:21 PM »
Tim,

How could one get the symbol associated with an enum?

nivuahc

  • Guest
Re: [Help] Table Gridlines
« Reply #5 on: January 14, 2010, 04:28:16 PM »
A nil with ActiveX doesn't mean that it didn't work.  You might have to regen after the code to see if it worked, or you could try the Update method on the table.

Tried both, no dice  :-(

T.Willey

  • Needs a day job
  • Posts: 5251
Re: [Help] Table Gridlines
« Reply #6 on: January 14, 2010, 04:37:23 PM »
The property you want is ' SetGridLineStyle ', and you have to change it per cell.  Single = 1; Double = 2.

Code: [Select]
(vla-setgridlinestyle ob2 1 1 acHorzBottom 1)

Tim,

How could one get the symbol associated with an enum?

I don't know, except per trial and error, unless they are listed elsewhere.  Maybe in the Arx help?  I'll see if I can find anything.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

nivuahc

  • Guest
Re: [Help] Table Gridlines
« Reply #7 on: January 14, 2010, 04:37:41 PM »
Code: [Select]
Command: (vla-GetGridLinestyle TblObj 0 1 acHorzBottom)
2

Command: (vla-GetGridLinestyle TblObj 1 1 acHorzBottom)
1

Command: (vla-GetGridLinestyle TblObj 1 1 acHorzTop)
2

Command: (vla-SetGridLinestyle TblObj 2 1 acHorzBottom 2)

Bingo Bango!  :lol:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: [Help] Table Gridlines
« Reply #8 on: January 14, 2010, 04:44:02 PM »
I was faster... I won!!!  :lol:

Edit:
Tim,

How could one get the symbol associated with an enum?

I had to use reflector, but the enums are not the same as what was shown, but the ones from reflector work.
Example
4 = acHorzBottom
Code: [Select]
(vla-setgridlinestyle ob2 1 1 4 1)

Edit2:
Found this in one of the arx docs, for GridLineType
Quote
AllGridLines = 0x3f  All grid line types 
HorizontalBottom = 4  The top or bottom horizontal grid line of the table, depending on flow direction. 
HorizontalGridLines = 7  Outer grid line types 
HorizontalInside = 2  All horizontal grid lines, excluding the top and bottom lines. 
HorizontalTop = 1  The top or bottom horizontal grid line of the table, depending on flow direction. 
InnerGridLines = 0x12  Inner grid line types 
InvalidGridLine = 0  Invalid. 
OuterGridLines = 0x2d  Outer grid line types 
VerticalGridLines = 0x38  Vertical grid line types 
VerticalInside = 0x10  All vertical grid lines, excluding the ones on the far left and far right of the table. 
VerticalLeft = 8  The grid line at the far left of the table. 
VerticalRight = 0x20  The grid line at the far right of the table. 
« Last Edit: January 14, 2010, 04:51:37 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: [Help] Table Gridlines
« Reply #9 on: January 14, 2010, 04:53:11 PM »

Edit:
Tim,

How could one get the symbol associated with an enum?

I had to use reflector...

What is reflector?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: [Help] Table Gridlines
« Reply #10 on: January 14, 2010, 04:55:33 PM »
Code: [Select]
Command: (vla-GetGridLinetype TblObj 0 1 acHorzBottom)
2128841888

Just to finish this up, the code posted above will get the LineType ObjectId of the cell specified.
Example
Code: [Select]
Command: (vlax-invoke actdoc 'objectidtoobject (vla-getgridlinetype ob2 1 1 4))
#<VLA-OBJECT IAcadLineType 1a6a555c>
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: [Help] Table Gridlines
« Reply #11 on: January 14, 2010, 04:57:37 PM »

Edit:
Tim,

How could one get the symbol associated with an enum?

I had to use reflector...

What is reflector?

It's a program used to disassemble program files, dll exe, so that you can see what is available to use with that.  I may not be totally correct there, but that is what it does in my mind.   :-)

http://www.red-gate.com/products/reflector/
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: [Help] Table Gridlines
« Reply #12 on: January 14, 2010, 04:58:52 PM »
Code: [Select]
Command: (vla-GetGridLinetype TblObj 0 1 acHorzBottom)
2128841888

Just to finish this up, the code posted above will get the LineType ObjectId of the cell specified.
Example
Code: [Select]
Command: (vlax-invoke actdoc 'objectidtoobject (vla-getgridlinetype ob2 1 1 4))
#<VLA-OBJECT IAcadLineType 1a6a555c>

Ahh, did not know that - so what I said above was a load of rubbish then  :oops:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: [Help] Table Gridlines
« Reply #13 on: January 14, 2010, 05:09:55 PM »
Code: [Select]
Command: (vla-GetGridLinetype TblObj 0 1 acHorzBottom)
2128841888

Just to finish this up, the code posted above will get the LineType ObjectId of the cell specified.
Example
Code: [Select]
Command: (vlax-invoke actdoc 'objectidtoobject (vla-getgridlinetype ob2 1 1 4))
#<VLA-OBJECT IAcadLineType 1a6a555c>

Ahh, did not know that - so what I said above was a load of rubbish then  :oops:

I only learned it cuz I read the help files, and thought that method sounded wrong for what the OP wanted.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: [Help] Table Gridlines
« Reply #14 on: January 14, 2010, 05:56:58 PM »
Code: [Select]
Command: (vla-GetGridLinetype TblObj 0 1 acHorzBottom)
2128841888

Just to finish this up, the code posted above will get the LineType ObjectId of the cell specified.
Example
Code: [Select]
Command: (vlax-invoke actdoc 'objectidtoobject (vla-getgridlinetype ob2 1 1 4))
#<VLA-OBJECT IAcadLineType 1a6a555c>

Ahh, did not know that - so what I said above was a load of rubbish then  :oops:

I only learned it cuz I read the help files, and thought that method sounded wrong for what the OP wanted.

Nice one :-)

To be honest, I don't like the Table functions, I'm not sure why ADesk didn't stick to the standard vla-put-Something/vla-get-Something, instead of vla-getSomething/setSomething...

Lee