Inserting a Block in Layout from the right side of various paper sizes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The company that I'm working with is making the move to Autodesk Vault for our file management needs. So I was doned with the task of creating the scripts that we will be using to convert all of our titleblocks to our new standard and also insert a drawing properties block that Vault will use to populate the metadata. I will be using Script Pro for this, which will use the accoreconsole.exe ILO of acad.exe to reduce the time it takes per drawing.
The issue that I'm having is that we have different papersizes depending on the region that office is located at (22x34, 24x36, 30x42, etc.). So I need to be able to insert our block with attributes at a set location based from the right side of the sheet, which varies. I can't solve the issue by changing the base point of the block, due to the varying width of sheets, so I need to be able to have some sort of code that will check the width of the paper and insert the block at the appropriate location (X = (Paper Width) - 2.875, Y = 0.5625"). I found a lisp at JTB World that would get the papersize, but can't figure out how to incorporate this into my current action inside my script. The code I found is:
; get paper size on current tab (defun papersize (/ psn scale) (setq psn (member '(100 . "AcDbPlotSettings") (dictsearch (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_LAYOUT"))) (getvar "ctab") ) ) ) (if (= (caadr psn) 1) ; Page Setup Name exist (progn (setq scale (if (= 0 (cdr (assoc 72 psn))) 25.4 1.0 ) ) (strcat (rtos (/ (cdr (assoc 44 psn)) scale) 2 2) " x " (rtos (/ (cdr (assoc 45 psn)) scale) 2 2) ) ) ) )
So I was figured that it would start by extracting the width and then subtracting what I need to locate it correctly in the X location, with -2.875 being the amount that it needs to move left based from the right side of the page.
((rtos (/ (cdr (assoc 44 psn)) scale) 2 2)-2.875)
Again, I don't know how to incorporate this into my current insert action and it still wouldn't help me specify the Y location. What I was using to insert the block at the basepoint of the layout is:
(command "-Insert" "C:/_Vault/_CAD Standards/_Titleblocks/Titleblock_Properties.dwg" "0" "0" 0" "1" "1" "0" )
Thanks in advance to any and all help on the matter.