Zwcad+ VBA drawing line problem

Rank: 1

akzwcad

Newbie

posts: 2

Registered: 2012-8-6

Message 1 of 6

  Zwcad+ VBA drawing line problem
07-09-2012 02:19 . pm | View his/her posts only
I am trying to draw a simple line with VBA code.
Code is very simple and it works under Zwcad2011.
But it dosn't work uder Zwcad+2012.
I try this Zwcad+ ver.num=2012.08.30(5622) and Windows7-64bit.
Zwcad+ doesn't recognize "ZwcadLine". What should I write for that.

Sub drawline()
Dim lineObj As ZwcadLine
Dim startpoint(0 To 2) As Double
Dim endpoint(0 To 2) As Double
startpoint(0) = 0
startpoint(1) = 0
startpoint(2) = 0
endpoint(0) = 10
endpoint(1) = 5
endpoint(2) = 0
Set lineObj = ThisDocument.ModelSpace.AddLine(startpoint, endpoint)
End Sub

Thanks,
0 Kudos

Rank: 1

seav735587

Newbie

posts: 9

Registered: 2012-9-7

Message 2 of 6

Zwcad+ VBA drawing line problem
07-09-2012 04:36 . pm | View his/her posts only
Change code a little.
....
Dim lineObj As ZcadLine
....
Set lineObj = ThisDrawing.ModelSpace.AddLine(startpoint, endpoint)
....
TOP 0 Kudos

Rank: 5Rank: 5

Daniel

posts: 261

Registered: 2012-6-6

Message 3 of 6

Zwcad+ VBA drawing line problem
07-09-2012 06:01 . pm | View his/her posts only
Yes, you are right.

Is your code works now?
TOP 0 Kudos

Rank: 1

seav735587

Newbie

posts: 9

Registered: 2012-9-7

Message 4 of 6

Zwcad+ VBA drawing line problem
07-09-2012 08:30 . pm | View his/her posts only
Yes.
I successfully ported my VBA code from AutoCAD to ZWCAD+ simply by changing "Acad" substrings to "Zcad" and several "ac" entries to "zc" (for example, zcActiveViewport, zcWorld, zcDisplayDCS, etc.)
Thanks,
TOP 0 Kudos

Rank: 5Rank: 5

Daniel

posts: 261

Registered: 2012-6-6

Message 5 of 6

Zwcad+ VBA drawing line problem
08-09-2012 08:45 . am | View his/her posts only
Good to hear that, and you're welcome
TOP 0 Kudos

Rank: 1

akzwcad

Newbie

posts: 2

Registered: 2012-8-6

Message 6 of 6

Zwcad+ VBA drawing line problem
09-09-2012 10:23 . pm | View his/her posts only
Yes, code is working now.
Thanks.
TOP 0 Kudos
© 2012 ZWCAD Software Co., Ltd. All rights reserved. | About ZWSOFT | Privacy Policy | Terms and Conditions | Contact us | Site Map
All trademarks,trade names or company names referenced herein are used for identification only and are the property of their respective owners.