CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.096.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedAlternative coordinate declaration VB

 Post Reply Post Reply
Author
mikedou View Drop Down
Newbie
Newbie


Joined: 16.Dec.2010
Location: Greece
Using: AutoCAD2011
Status: Offline
Points: 3
Direct Link To This Post Topic: Alternative coordinate declaration VB
    Posted: 16.Dec.2010 at 19:23
Hi guys. I have written some code in VB for autocad and for the moment i am declaring the coordinates in xyz axis as following:
Private Sub CreatePoints()
    SidePoints(0) = 400: SidePoints(1) = -105.25: SidePoints(2) = 215
    SidePoints(3) = N(8) - 400: SidePoints(4) = -105.25: SidePoints(5) = 215
    
    SidePoints(6) = 400: SidePoints(7) = 0: SidePoints(8) = 215
    SidePoints(9) = N(8) - 400: SidePoints(10) = 0: SidePoints(11) = 215.......
For example sidepoints(0),sidepoints(1),sidepoints(2) (x,y,z) are the coordinates for one point. It would be great if i could just write Sidepoints(400,105.25,215). Is there a simpler way to declare coordinates or that is the only method?
Back to Top
HAWDesigner View Drop Down
Senior Member
Senior Member


Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
Direct Link To This Post Posted: 16.Dec.2010 at 19:46
I'm not sure about the coordinates part, but all you're doing above is creating and populating an Array. So to answer your question, YES, there is an easier way to do what you're doing.

You can learn more about Array's here: http://www.w3schools.com/vbscript/func_array.asp

Basically what you can do is this:

SidePoints = Array(400,-105.25,215, [and so on...])
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009
Back to Top
mikedou View Drop Down
Newbie
Newbie


Joined: 16.Dec.2010
Location: Greece
Using: AutoCAD2011
Status: Offline
Points: 3
Direct Link To This Post Posted: 16.Dec.2010 at 19:58
Originally posted by HAWDesigner HAWDesigner wrote:

I'm not sure about the coordinates part, but all you're doing above is creating and populating an Array. So to answer your question, YES, there is an easier way to do what you're doing.

You can learn more about Array's here: http://www.w3schools.com/vbscript/func_array.asp

Basically what you can do is this:

SidePoints = Array(400,-105.25,215, [and so on...])

Unfortunately that code won't help me cause i need to make reference to specific points at some occasions. For example further down the code  i may need to declare a point equal to a previous one like: Sidepoints(1) =Rearpoints(5) .

Is there a way to declare the points like i "dream"...Sidepoints(1)=(5,400,230)?


Thanks you the response.

Back to Top
HAWDesigner View Drop Down
Senior Member
Senior Member


Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
Direct Link To This Post Posted: 16.Dec.2010 at 20:23
Ok, I think I understand. Yes, there is a way, but it will take some extra work to accomplish.

You will be putting that information into an Array, but before you put it in the Array (and after you take it out) you will have to prepare the data. For instance:

Dim SidePoints(1)
Dim strX, strY, strZ

strX = "5"
strY = "400"
strZ = "230"

SidePoints (1) = strX & "," & strY & "," & strZ

Then, when you pull the code out of the Array, you will have to create another routine to handle that. For instance:

strSidePoints=Split(SidePoints(1))
for each x in strSidePoints
    document.write(x & ",")
next

Your output should look like: 5,400,230


(I'm going off of memory here, so I apologize if my code isn't 100% correct; but I hope you get the idea. ALSO, there may be an easier way to do this, that's all I can come up with at the moment.)

Good Luck!!!
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009
Back to Top
mikedou View Drop Down
Newbie
Newbie


Joined: 16.Dec.2010
Location: Greece
Using: AutoCAD2011
Status: Offline
Points: 3
Direct Link To This Post Posted: 16.Dec.2010 at 20:30
Thanx again but that's not going to help either. See i have to declare 200 points more or less....
Back to Top
HAWDesigner View Drop Down
Senior Member
Senior Member


Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
Direct Link To This Post Posted: 16.Dec.2010 at 20:57
Ok, well there is a way to put this all into a loop and have it reiterate through as many points as you want.

Anyways, good luck!!
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,125 seconds.