Hi every body, I am using VBA for automation of drawing. In this I am drawing a line.To draw a line using VBA, you need to enter Strat Point & End Point. For general cases, I have length of line and its angle of full circle bearing. For example--I want to darw- @100'<156d24'45" But in VBA, i need to enter start point and end point. I tried it using Trigometric formula, to get the end point as i am provided with length and its angle. But could not generalize formula for all angles. Does any body have generalized method to find end point from start point for all angles? or It can be directly draw a line with length and angle in VBA? Second problem-- How can set preferences like direction of angles(By default for my template is east, but i want to make it North, want to measure clockwise) using VBA.
You just have to split your formula up depending on which direction the line is running. (NE,SE,NW,SW)
See the help for AngleToReal and DistanceToReal methods. I guess you'd have to split your strings at the "@" and "<". HTH, James ..
Hi Kumar, Calculate the second end point with "Thisdrawing.Utility.PolarPoint". The help files describe it in detail. The posts about quadrants and string splitting are totally irrelevant to your question. -- Laurie Comerford CADApps www.cadapps.com.au draw a line using VBA, you need to enter Strat Point & End Point. For general cases, I have length of line and its angle of full circle bearing. For example--I want to darw- Trigometric formula, to get the end point as i am provided with length and its angle. But could not generalize formula for all angles. template is east, but i want to make it North, want to measure clockwise) using VBA.
Laurie, I read Kumar's post to mean that the input to his program would be similar to @100'<156d24'45" and his program would need to turn this into a length in inches and an angle in radians. Kumar, VBA coordinates are all based on the World Coord System, which as far as I know is always (0 deg to the right, 90 deg is upward when looking at the screen). Easiest way to work with a different compass is probably to just make a conversion function. HTH, James
James, Laurie es right. Actually Kumar says he has a "length and its angle of full circle bearing", so the PolarPoint function is the way to go. The example he shows, I believe, its to explain how he would draw manually in ACAD. The thing Kumar has be carefull about is what type of angle he is feeding the PolarPoint function. First he has to convert to radians (no sweat there) Secondly he has to make sure that his angles are measured using ACADs default ( 0° is East and angles grow counterclockwise.)
Uhmm, just a quick look and seems to me that your Sub is wrong x2 and y2 are deltaX and deltaY not the actual coordinates of point 2 It should be: PX2 = x1 + x2 PY2 = y1 + y2 -- Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica (sorry, phony e-mail, SPAM made me do it) solve you problem. see attached file.