Jump to content

Recommended Posts

Posted

I have a BOM from EXCEL that I have pasted into ACADe as AutoCAD Entities.

These BOMs have different formatting (font, color, alignment).

 

I want a LISP routine that will clean up the table (remove colors, all same text size, correct alignment). I don't want to use OLE because there is additional info in the spreadsheet that we do not need in the drawing.

 

Here is some code I have that make the columns the correct size and alignment.

I still need:

- Make background fill NONE

- Set text height to same

- Change first two columns to WHOLE NUMBER

I have attached a sample of what I am talking about.

 

Thank You In Advance!

---------------------------------------------------

(defun c:ResizeTable()

(vl-load-com)

(setq tbl (vlax-ename->vla-object(car(entsel))))

(vla-setcolumnwidth tbl 0 0.525)

(vla-setcolumnwidth tbl 1 0.525)

(vla-setcolumnwidth tbl 2 1.5)

(vla-setcolumnwidth tbl 3 3.075)

(vla-setcolumnwidth tbl 4 1.5)

(vla-setcolumnwidth tbl 5 1.0)

(setq rows (vla-get-rows tbl)) ;;get number of rows

 

(setq currentRow 0)

(repeat rows - 2 ;;repeat for all the rows in the table

(vla-SetCellAlignment tbl currentRow 0 acMiddleCenter)

(vla-SetCellAlignment tbl currentRow 1 acMiddleCenter)

(vla-SetCellAlignment tbl currentRow 2 acMiddleLeft)

(vla-SetCellAlignment tbl currentRow 3 acMiddleLeft)

(vla-SetCellAlignment tbl currentRow 4 acMiddleLeft)

(vla-SetCellAlignment tbl currentRow 5 acMiddleCenter)

;;(vla-setrowheight tbl currentRow 1) ;Change row height (TEST)

(setq currentRow (+ 1 currentRow))

)

)

---------------------------------------------------

TEST.dwg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...