www ozgrid com

7
Forum HELP FORUMS EXCEL HELP Exporting To Autocad Search Ozgrid Excel Help & Best Practices Forums Excel Video Tutorials / Excel Dashboards Reports If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, register or log in above. Thread: Exporting To Autocad Trading Add-ins For XL | Excel Add-ins | Excel Templates | Excel Web Pages Scheduling In Excel | Home/Construction Estimating In XL | Print VBA Code | Sparkmaker Merge Excel The Easy Way | Smart VBA | Build Automated Trading Models In Excel Excel Video Training/Tutoring | Excel Dashboard Reports User Name Password Log in Remember Me? Register Help What's New? New Posts FAQ Calendar Forum Actions Quick Links Advanced Search Results 1 to 10 of 17 Page 1 of 2 1 2 Last Sign Up to see what your friends like. Like Like Thread Tools Search Thread April 11th, 2007 Join Date: Location: Posts: 29th June 2006 Poland 67 #1 Member keekooceeaou Forum converted by Web2PDFConvert.com

Upload: jhdmss

Post on 27-Dec-2015

1 views

Category:

Documents


0 download

TRANSCRIPT

Forum HELP FORUMS EXCEL HELP Exporting To Autocad

Search

Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above toproceed. To start viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, registeror log in above.

Thread: Exporting To Autocad

Trading Add-ins For XL | Excel Add-ins | Excel Templates | Excel Web Pages Scheduling In Excel | Home/Construction Estimating In XL | Print VBA Code | Sparkmaker Merge Excel The Easy Way | Smart VBA | Build Automated Trading Models In Excel Excel Video Training/Tutoring | Excel Dashboard Reports

User Name Password Log in

Remember Me?RegisterHelp

What's New?

New Posts FAQ Calendar Forum Actions Quick Links Advanced Search

Results 1 to 10 of 17 Page 1 of 2 1 2 Last

Sign Up to see what your friends like.LikeLike

Thread Tools Search Thread

April 11th, 2007

Join Date:Location:Posts:

29th June 2006Poland

67

#1

Memberkeekooceeaou

Forum

converted by Web2PDFConvert.com

Exporting To Autocad

Hi,

I have some data in Excel that I want to export to AutoCAD using VBA Code in Excel. But Idon't want to have a table inserted in AutoCAD, but polylines and multitext.Is it possible?

If someone could give me an example, how to draw simple polyline and insert mtext inAutoCAD (from Excel VBA Code) I should be able do do the rest.

Thanks in advance,Paul

PS. I think that it would be required to specify insertion point, wouldn't it?

Excel Video Tutorials / Excel Dashboards Reports

Project MgmtSoftware

quickbase.intuit.com

Try it Free for 30Days- Start Now!Automate BusinessProcesses & More.

Reply With Quote

April 11th, 2007

Join Date:Location:Posts:

2nd December 2004Frankfurt, D

383

Re: Exporting To Autocad

Maybe there is a better and faster way, but I think you should try writing a routine in AUTOLISP. Last time I use it was 10 yrs ago ( AutoCad 10 ? ),so I don't know if I can help you codewise. I will check at home if I still have some AUTOLISP book left.

filippo

Excel Video Tutorials / Excel Dashboards Reports

#2

Established Memberfilo65

Reply With Quote

April 11th, 2007

Join Date:Location:Posts:

10th February 2003Palm Beach, Florida

1,590

#3

OzMVPAaron Blood

converted by Web2PDFConvert.com

Re: Exporting To Autocad

Just out of curiosity...

What is it you need autocad to do that you can't do with Excel.

...or is Excel just a launching point for a much larger autocad task?

Sub All_Macros(Optional control As Variant)

Reply With Quote

April 12th, 2007

Join Date:Location:Posts:

29th June 2006Poland

67

Re: Exporting To Autocad

Hi,

thanks for answers.

I made automated parts specification in Excel.I would like to have an "Export to AutoCAD" button, that would paste this specification to ACAD drawing, so I wouldn't have to type it manually.

I know that it's possible to write it in LISP and run from AutoCAD, but I want to run my macro in Excel. My table must consist of polylines and text so I can't just paste it as table.

Excel Video Tutorials / Excel Dashboards Reports

#4

Memberkeekooceeaou

Reply With Quote

April 12th, 2007

Join Date:Posts:

29th January 200735

Re: Exporting To Autocad

Post a dwg file with the look you want and a spreadsheet and I think I can help you out.

ska

Last edited by ska67can; April 12th, 2007 at 02:07.

Excel Video Tutorials / Excel Dashboards Reports

#5

Memberska67can

Reply With Quote

April 12th, 2007

Join Date:Location:Posts:

29th June 2006Poland

67

Re: Exporting To Autocad

ska: here you are :-), and thanks for any help

Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYSrun an up-to-date virus scan and disable macros.

exporting.rar (39.4 KB, 240 views)

Excel Video Tutorials / Excel Dashboards Reports

#6

Memberkeekooceeaou

converted by Web2PDFConvert.com

Reply With Quote

April 12th, 2007

Join Date:Posts:

29th January 200735

Re: Exporting To Autocad

I'll have a look at it tonight

ska

Excel Video Tutorials / Excel Dashboards Reports

#7

Memberska67can

Reply With Quote

April 15th, 2007

Join Date:Posts:

29th January 200735

Re: Exporting To Autocad

keekoo,

Sorry for the delay. I had never worked with MText in VBA before. Also the Playoffs are on, so not a lot of free time.

Anyways, add this code to a new module in your worksheet. Be sure to add a reference to whichever version of Autocad you're using. If you haveany problems or questions, let me know.

VB:Option Explicit Sub Ex_Acad() Dim oAcad As Object Dim oDoc As AcadDocument Dim oPaper As AcadPaperSpace Dim Pts1(0 To 2) As Double Dim Pts2(0 To 2) As Double Dim Pts3(0 To 2) As Double Dim Pts4(0 To 2) As Double Dim Pts5(0 To 2) As Double Dim Pts6(0 To 2) As Double Dim Pts7(0 To 2) As Double Dim Pts8(0 To 2) As Double Dim Points(0 To 43) As Double Dim blockObj As AcadBlock Dim blockRefObj As AcadBlockReference Dim pLine As AcadLWPolyline Dim x As Double Dim i As Integer Dim sht As Worksheet Dim dtxt As AcadText Dim mtxt As AcadMText Dim varAtt As Variant On Error Goto ERRORMSG 'If Autocad is not Running, Message and Quit Set oAcad = GetObject(, "Autocad.Application") 'Get the Open Instance of AutoCad On Error Goto 0 'Reset Error Set oDoc = oAcad.ActiveDocument 'Set the Active Drawing Set oPaper = oDoc.PaperSpace Set sht = ActiveWorkbook.Sheets(1) 'Set the Spreadsheet If sht.Cells(4, 2) = "" Then Exit Sub 'Check for Info to Export - If Cell B4 is Blank Quit oDoc.ActiveLayer = oDoc.Layers("0_TABL") 'Set Layer Pts1(0) = 0: Pts1(1) = 0: Pts1(2) = 0 'Set Insertion Point for Temp Block Set blockObj = oDoc.Blocks.Add(Pts1, "Temp") 'Create Temporary Block for Border Points(0) = 0: Points(1) = 0: Points(2) = 0: Points(3) = 9.21: Points(4) = 12.4: Points(5) = 9.21 Points(6) = 12.4: Points(7) = 0: Points(8) = 12.4: Points(9) = 9.21: Points(10) = 82.4: Points(11) = 9.21 Points(12) = 82.4: Points(13) = 0: Points(14) = 82.4: Points(15) = 9.21: Points(16) = 92.4: Points(17) = 9.21 Points(18) = 92.4: Points(19) = 0: Points(20) = 92.4: Points(21) = 9.21: Points(22) = 122.4: Points(23) = 9.21 Points(24) = 122.4: Points(25) = 0: Points(26) = 122.4: Points(27) = 9.21: Points(28) = 152.4: Points(29) = 9.21 Points(30) = 152.4: Points(31) = 0: Points(32) = 152.4: Points(33) = 9.21: Points(34) = 164.4: Points(35) = 9.21 Points(36) = 164.4: Points(37) = 0: Points(38) = 164.4: Points(39) = 9.21: Points(40) = 180.8: Points(41) = 9.21 Points(42) = 180.8: Points(43) = 0 Set pLine = blockObj.AddLightWeightPolyline(Points) 'Draw Border Pts1(0) = 205: Pts1(1) = 71.6: Pts1(2) = 0 'Insertion Point For Header Block Set blockRefObj = oPaper.InsertBlock(Pts1, "TABL_poz", 1#, 1#, 1#, 0) 'Insert Your Header Block Pts1(0) = 24.2: Pts1(1) = 72.79: Pts1(2) = 0 'Set Starting Points for Offset Pts2(0) = 30.4: Pts2(1) = 75.67: Pts2(2) = 0 Pts3(0) = 38.6: Pts3(1) = 77.4: Pts3(2) = 0 Pts4(0) = 111.6: Pts4(1) = 76.16: Pts4(2) = 0 Pts5(0) = 131.6: Pts5(1) = 77.4: Pts5(2) = 0 Pts6(0) = 161.6: Pts6(1) = 77.4: Pts6(2) = 0 Pts7(0) = 187.35: Pts7(1) = 76.21: Pts7(2) = 0

#8

Memberska67can

converted by Web2PDFConvert.com

Pts7(0) = 187.35: Pts7(1) = 76.21: Pts7(2) = 0 Pts8(0) = 203.03: Pts8(1) = 76.16: Pts8(2) = 0 x = 9.21 'Offset for Temp Block oDoc.ActiveTextStyle = oDoc.TextStyles("Romans") 'Set Text Style For i = 4 To sht.Cells(100, 2).End(xlUp).Row Step 2 Pts1(1) = Pts1(1) + x: Pts2(1) = Pts2(1) + x: Pts3(1) = Pts3(1) + x: Pts4(1) = Pts4(1) + x 'Set Insertion Points (Offset) Pts5(1) = Pts5(1) + x: Pts6(1) = Pts6(1) + x: Pts7(1) = Pts7(1) + x: Pts8(1) = Pts8(1) + x Set blockRefObj = oPaper.InsertBlock(Pts1, "Temp", 1#, 1#, 1#, 0) 'Insert Border Set dtxt = oPaper.AddText(sht.Cells(i, 2).Text, Pts2, 3.5) 'Insert Text dtxt.Alignment = acAlignmentCenter 'Set Text Alignment dtxt.TextAlignmentPoint = Pts2 dtxt.Color = acCyan Set mtxt = oPaper.AddMText(Pts3, 70, sht.Cells(i, 3).Text) 'Insert Text mtxt.Height = 2.4 mtxt.AttachmentPoint = acAttachmentPointMiddleLeft mtxt.InsertionPoint = Pts3 Set dtxt = oPaper.AddText(sht.Cells(i, 6).Text, Pts4, 2.4) 'Insert Text dtxt.Alignment = acAlignmentCenter 'Set Text Alignment dtxt.TextAlignmentPoint = Pts4 Set mtxt = oPaper.AddMText(Pts5, 30, sht.Cells(i, 4).Text) 'Insert Text mtxt.Height = 2.4 mtxt.AttachmentPoint = acAttachmentPointMiddleCenter mtxt.InsertionPoint = Pts5 Set mtxt = oPaper.AddMText(Pts6, 30, sht.Cells(i, 5).Text) 'Insert Text mtxt.Height = 2.4 mtxt.AttachmentPoint = acAttachmentPointMiddleCenter mtxt.InsertionPoint = Pts6 Set dtxt = oPaper.AddText(sht.Cells(i, 7).Text, Pts7, 2.4) 'Insert Text dtxt.Alignment = acAlignmentRight 'Set Text Alignment dtxt.TextAlignmentPoint = Pts7 Set dtxt = oPaper.AddText(sht.Cells(i, 8).Text, Pts8, 2.4) 'Insert Text dtxt.Alignment = acAlignmentRight 'Set Text Alignment dtxt.TextAlignmentPoint = Pts8 Next i oDoc.ActiveLayer = oDoc.Layers("2DM_OBV") 'Set Layer for Weight Summary Block Pts1(0) = Pts1(0) + 140.36: Pts1(1) = Pts1(1) + 15 'Set Insertion for Weight Summary Block Set blockRefObj = oPaper.InsertBlock(Pts1, "TABL_suma", 1#, 1#, 1#, 0) 'Insert Weight Summary Block varAtt = blockRefObj.GetAttributes varAtt(0).TextString = sht.Cells(100, 7).End(xlUp).Text 'Modify Attribute oDoc.ActiveLayer = oDoc.Layers("0") 'Reset Default Layer Exit Sub ERRORMSG: 'If Autocad is not Open this will Run MsgBox "Autocad Must Be Open" End Sub

ska

Excel Video Tutorials / Excel Dashboards Reports

Reply With Quote

April 16th, 2007

Join Date:Location:Posts:

29th June 2006Poland

67

Re: Exporting To Autocad

Wow!

Thank You very much.I didn't even hope to get that much ;-)

I don't have time now to try this, but it looks promising.I will let You know when I try this out.

Paul

Excel Video Tutorials / Excel Dashboards Reports

#9

Memberkeekooceeaou

Reply With Quote

April 16th, 2007

Join Date:Location:Posts:

29th June 2006Poland

67

#10

Memberkeekooceeaou

converted by Web2PDFConvert.com

-- vB4 Default Style

« Xml Integration | Counting Selections Made With Control Toolbox Controls »

EXCEL TRADER PACKAGE

Free Excel\VBA Help Forum Archive Privacy Statement Top

All times are GMT +9. The time now is 18:07.

Re: Exporting To Autocad

PS. I tried to run it and I have one problem,at following lines:

VB:Dim oDoc As AcadDocument Dim oPaper As AcadPaperSpace Dim blockObj As AcadBlock Dim blockRefObj As AcadBlockReference Dim pLine As AcadLWPolyline Dim dtxt As AcadText Dim mtxt As AcadMText

i get an error "User-defined type not defined".

Excel Video Tutorials / Excel Dashboards Reports

ITT Tech - OfficialSite

itt-tech.edu

Associate, BachelorDegree Programs BrowsePrograms Now & LearnMore.

SpaceClaimEngineer 2014

QuickBooksOnline Free

How to RemoveMalware

Windows 7 DriverDownload

Reply With Quote

Page 1 of 2 1 2 Last

Quick Navigation EXCEL HELP Top

Embedded Spreadsheets In AutocadBy cougar in forum EXCEL HELP

Replies: 2Last Post: January 18th, 2007, 09:39

Exporting: Exporting Excel data to XML - transposing fieldsBy jlgmax in forum EXCEL HELP

Replies: 8Last Post: June 11th, 2003, 18:16

Exporting: Excell 2000 problem exporting to Pocket PCBy adamvasco in forum EXCEL HELP

Replies: 1Last Post: June 9th, 2003, 22:16

Excel to AutoCAD and backBy blue in forum EXCEL HELP

Replies: 4Last Post: February 20th, 2003, 23:09

Thread Information

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

Digg del.icio.us StumbleUpon Google

Bookmarks

You may not post new threadsYou may not post repliesYou may not post attachmentsYou may not edit your posts

Posting Permissions

BB code is OnSmilies are On[IMG] code is On[VIDEO] code is OnHTML code is Off

Forum Rules

converted by Web2PDFConvert.com

Ozgrid is Not Associated With Microsoft. Ozgrid Retains the Rights to ALL Posts and Threads

converted by Web2PDFConvert.com