Author Topic: Sheet Index  (Read 7605 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Sheet Index
« Reply #15 on: September 18, 2020, 12:13:54 PM »
This is incredible, Michael.

Nice! You're too kind Alan.

Much of it was merely the translation of other's fine work (GILESP, Jeff H and JAR).

All of it was highly enjoyable, nerdy fun. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Sheet Index
« Reply #16 on: September 18, 2020, 12:44:47 PM »
This is incredible, Michael.

Nice! You're too kind Alan.

Much of it was merely the translation of other's fine work (GILESP, Jeff H and JAR).

All of it was highly enjoyable, nerdy fun. :)
Yeah, well, I was able to adapt it into a project I have written in XOJO for publishing PDFs, doing etransmits and such. It really is an incredible piece of work. I may indeed be using it to do what I am trying to accomplish here. I just need to figure out a way to determine what sheet set is being used by the open file.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Sheet Index
« Reply #17 on: September 18, 2020, 01:26:23 PM »
Yeah, well, I was able to adapt it into a project I have written in XOJO for publishing PDFs, doing etransmits and such. It really is an incredible piece of work.

It's music to hear a post helped out a fellow forumite. Thanks for sharing. 8-)

I just need to figure out a way to determine what sheet set is being used by the open file.

Keep digging, it's there somewhere -- it always is. :-)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Sheet Index
« Reply #18 on: September 18, 2020, 02:46:47 PM »
Yeah, well, I was able to adapt it into a project I have written in XOJO for publishing PDFs, doing etransmits and such. It really is an incredible piece of work.

It's music to hear a post helped out a fellow forumite. Thanks for sharing. 8-)

I just need to figure out a way to determine what sheet set is being used by the open file.

Keep digging, it's there somewhere -- it always is. :-)

The tool is very, very preliminary and I believe it had the credit for your code (I have since started a complete redesign of the tool for various reasons unrelated to your code), but I had posted it here:
http://www.theswamp.org/index.php?topic=54482.msg589986#msg589986


And I know it has to be there somewhere, otherwise how does AutoCAD know what sheetset to autoopen?
« Last Edit: September 18, 2020, 03:03:53 PM by cmwade77 »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Sheet Index
« Reply #19 on: September 18, 2020, 03:09:05 PM »
And I know it has to be there somewhere, otherwise how does AutoCAD know what sheetset to autoopen?

If I had to hazard a guess it would be to ...

Code: [Select]
(progn
    (vl-load-com)
    (setq doc (vla-get-activedocument (vlax-get-acad-object)))
    (vl-catch-all-apply 'eval '((setq dic (vla-item (vla-get-dictionaries doc) "AcSheetSetData"))))
    (if dic
        (progn
            (princ "\nHouston we may have lift off ...")
            ;;  miracle code to follow ...
        )
    )   
    (princ)
)

But that's just me.  :-)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Sheet Index
« Reply #20 on: September 18, 2020, 04:09:14 PM »
And I know it has to be there somewhere, otherwise how does AutoCAD know what sheetset to autoopen?

If I had to hazard a guess it would be to ...

Code: [Select]
(progn
    (vl-load-com)
    (setq doc (vla-get-activedocument (vlax-get-acad-object)))
    (vl-catch-all-apply 'eval '((setq dic (vla-item (vla-get-dictionaries doc) "AcSheetSetData"))))
    (if dic
        (progn
            (princ "\nHouston we may have lift off ...")
            ;;  miracle code to follow ...
        )
    )   
    (princ)
)

But that's just me.  :-)
Yeah, that tells me there is a Sheet Set associated to the layout, but what I need to know is what DST File (including path) I need to open. Yeah, I can do it the hard way and poke around the folder structure, but there has to be a better way.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Sheet Index
« Reply #21 on: September 18, 2020, 04:57:05 PM »
I must be missing something. Bare bones code sans error trapping yada ...

Code: [Select]
(cdr
    (assoc 1
        (entget
            (vlax-vla-object->ename
                (vla-item
                    (vla-item
                        (vla-get-dictionaries
                            (vla-get-activedocument
                                (vlax-get-acad-object)
                            )
                        )
                        "AcSheetSetData"
                    )
                    "ShSetFileName"
                )
            )
        )
    )
)
                                               

>> "C:\\Program Files\\Autodesk\\AutoCAD 2019\\Sample\\Sheet Sets\\Architectural\\IRD Addition.dst"

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Sheet Index
« Reply #22 on: September 18, 2020, 05:03:48 PM »
I must be missing something. Bare bones code sans error trapping yada ...

Code: [Select]
(cdr
    (assoc 1
        (entget
            (vlax-vla-object->ename
                (vla-item
                    (vla-item
                        (vla-get-dictionaries
                            (vla-get-activedocument
                                (vlax-get-acad-object)
                            )
                        )
                        "AcSheetSetData"
                    )
                    "ShSetFileName"
                )
            )
        )
    )
)
                                               

>> "C:\\Program Files\\Autodesk\\AutoCAD 2019\\Sample\\Sheet Sets\\Architectural\\IRD Addition.dst"
Awesome, that should get me started.

framednlv

  • Newt
  • Posts: 64
Re: Sheet Index
« Reply #23 on: September 21, 2020, 11:45:03 AM »
(getvar 'ssfound)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Sheet Index
« Reply #24 on: September 21, 2020, 12:49:56 PM »
Assume find -- hadn't considered Autodesk would actually make something easy.  :-D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

framednlv

  • Newt
  • Posts: 64
Re: Sheet Index
« Reply #25 on: September 21, 2020, 12:53:04 PM »
The 'ssfound only applies if the sheet set file is open in the Sheet Set Manager.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Sheet Index
« Reply #26 on: September 21, 2020, 01:15:31 PM »
The 'ssfound only applies if the sheet set file is open in the Sheet Set Manager.
Well, that is good to know, this is going to be an interesting one for me, because I just figured out that stealing what I already have written with LISP will result in much easier and more reliable programming. So, all of this information is going to be quite useful, thank you all.

steve.carson

  • Newt
  • Posts: 108
Re: Sheet Index
« Reply #27 on: September 25, 2020, 12:05:20 PM »
Using the great code by MP for the DST->XML functions, by Lee Mac for the Table and DCL functions, and J. Szewczak for the XML functions, I put together the attached sheetset functions, some more useful than others. I'm sure anything written by me could be improved. I think this was the second time I played with DCL, so there was a lot of guess-and-check going on.

I think the most useful function in here is the "sstable" function that lets you create a regular autocad table from multiple dst files. This is handy for when you have separate dst's for each discipline in a project. I tried to mimic the built in method to create a sheet list table from the SSM, where you can specify the column headings for whatever property you want in the table. It stores an xrecord in the drawing, and uses it as defaults for the next time you run it. It's not very fast, but much faster than built in methods. Our projects are pretty big (Ports and Harbors, Marine structures).

There is also a function to index a sheet property ("indexss"), which is handy for the X in "sheet X of XX".

Hope for can find it useful!


Big thanks to MP, Lee Mac, and J. Szewczak!


Steve

steve.carson

  • Newt
  • Posts: 108
Re: Sheet Index
« Reply #28 on: September 25, 2020, 12:09:32 PM »
Oh, yeah, forgot to mention there is always an error displayed at the command line when running the sstable function. I was never able to track it down, but it runs and completes and creates the table.



Steve

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Sheet Index
« Reply #29 on: October 07, 2020, 05:54:11 PM »
Ok, so I know this is a long shot, but maybe MP or someone else can help me out with this. I am currently writing this in XOJO, I have the routine down for decoding the DST file, but for some reason, encoding it back after I make edits doesn't work.

Here is what I have:
Code: [Select]
'Adapted from VBScript at: https://www.theswamp.org/index.php?topic=46497.msg573062#msg573062 and from LISP at: http://www.theswamp.org/index.php?topic=52362.0
Var Results As String
Var enc() As Integer = Array(0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,20,21,22,23,24,25,26,27,30,31,32,33,34,35,36,37,40,41,42,43,44,45,46,47,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,70,71,72,73,74,75,76,77,100,101,102,103,104,105,106,107,110,111,112,113,114,115,116,117,120,121,122,123,124,125,126,127,130,131,132,133,134,135,136,137,140,141,142,143,144,145,146,147,150,151,152,153,154,155,156,157,160,161,162,163,164,165,166,167,170,171,172,173,174,175,176,177,200,201,202,203,204,205,206,207,210,211,212,213,214,215,216,217,220,221,222,223,224,225,226,227,230,231,232,233,234,235,236,237,240,241,242,243,244,245,246,247,250,251,252,253,254,255,256,257,260,261,262,263,264,265,266,267,270,271,272,273,274,275,276,277,300,301,302,303,304,305,306,307,310,311,312,313,314,315,316,317,320,321,322,323,324,325,326,327,330,331,332,333,334,335,336,337,340,341,342,343,344,345,346,347,350,351,352,353,354,355,356,357,360,361,362,363,364,365,366,367,370,371,372,373,374,375,376,377)
Var dec() As Integer = Array(214,213,216,215,210,207,212,211,204,203,206,205,200,177,202,201,174,173,176,175,170,167,172,171,164,163,166,165,160,157,162,161,254,253,256,255,250,247,252,251,244,243,246,245,240,237,242,241,234,233,236,235,230,227,232,231,224,223,226,225,220,217,222,221,314,313,316,315,310,307,312,311,304,303,306,305,300,277,302,301,274,273,276,275,270,267,272,271,264,263,266,265,260,257,262,261,354,353,356,355,350,347,352,351,344,343,346,345,340,337,342,341,334,333,336,335,330,327,332,331,324,323,326,325,320,317,322,321,14,13,16,15,10,7,12,11,4,3,6,5,0,377,2,1,374,373,376,375,370,367,372,371,364,363,366,365,360,357,362,361,54,53,56,55,50,47,52,51,44,43,46,45,40,37,42,41,34,33,36,35,30,27,32,31,24,23,26,25,20,17,22,21,114,113,116,115,110,107,112,111,104,103,106,105,100,77,102,101,74,73,76,75,70,67,72,71,64,63,66,65,60,57,62,61,154,153,156,155,150,147,152,151,144,143,146,145,140,137,142,141,134,133,136,135,130,127,132,131,124,123,126,125,120,117,122,121)
If Decode Then
  For x As Integer = 1 To fInfo.Length
    Var InChar As String = fInfo.Mid(x, 1)' Read character
    Var AChar As Integer = AscB(InChar)' Convert to AscII Character
    Var Con8Char As Integer = dec(AChar)' Read Character (in Octal) from array
    Var ConChar As String = Chr(Integer.FromOctal(Con8Char.ToText))'convert octal to integer
    If results = "" Then
      Results = ConChar
    Else
      Results = Results + ConChar
    End If
  Next x
Else
  For x As Integer = 1 To fInfo.Length
    Var InChar As String = fInfo.Mid(x, 1)' Read character
    Var AChar As Integer = AscB(InChar)' Convert to AscII Character
    Var A8Char As Integer = Oct(AChar).Val
    Var Pos As Integer = dec.IndexOf(A8Char)
    If pos > -1 And pos <= enc.LastRowIndex Then
      Var Con8Char As Integer = enc(pos)
      Var ConChar As String = Chr(Integer.FromOctal(Con8Char.ToText))
      If results = "" Then
        Results = ConChar
      Else
        Results = Results + ConChar
      End If
    End If
  Next x
End If
Return Results

NOTE: Integer.FromOctal is essentially the same as the EVAL function, but doesn't need &O at the beginning, but the number as to be converted to text.

I am sure I probably just have something out of place, but can't quite figure it out.