VBA Create Arch from 3 points

VBA Create Arch from 3 points

jalal.mousa
Advocate Advocate
778 Views
5 Replies
Message 1 of 6

VBA Create Arch from 3 points

jalal.mousa
Advocate
Advocate

Hi There,

i would like to create Arch from the last three points used to create closed polyline

so on Error i would like to use [Lastpoint/Ok/Resume/Delete/Arch]: ") Arch option and code will use last three points entered by use to create arch

see attached i would like to convert for example points 3 to 5 as Arch then continue tracing room

 

On Error Resume Next
For i = 0 To 2000 Step 3

Label1:
AktPt = MyDWG.Utility.GetPoint

ReDim Preserve points(i + 5) As Double
plineObj.Delete

points(i) = AktPt(0)
points(i + 1) = AktPt(1)
points(i + 2) = AktPt(2)

points(i + 3) = points(0)
points(i + 4) = points(1)
points(i + 5) = points(2)

Set plineObj = MyDWG.ModelSpace.AddPolyline(points)

'LastplineObj = MyDWG.ModelSpace.AddPolyline(points)
If Err Then
Err.Clear

returnString = MyDWG.Utility.GetKeyword(vbLf & "Enter a keyword [Lastpoint/Ok/Resume/Delete/Arch]: ")

 

Moderator edit: Put code in code window. Please use </>  button to add.

0 Likes
Accepted solutions (1)
779 Views
5 Replies
Replies (5)
Message 2 of 6

Ed__Jobe
Mentor
Mentor

The PLINE command already does this. You just have to choose the ARC option, and then there are options for creating an arc. Is there a reason you need to do this programmatically?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 6

jalal.mousa
Advocate
Advocate

yes i am using Excel to do drawing and program return Area automatically to Excel

 

0 Likes
Message 4 of 6

Ed__Jobe
Mentor
Mentor

Ok, may I suggest, rather than retracing over existing lines and arcs, use them to create a region and then get Area property.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 6

jalal.mousa
Advocate
Advocate

Hi Ed,

thanks for getting back to me

the reason i am doing tracing is that file i have is PDF and inserted to Autocad as an image or imported to from pdf file

as per screen shot below

 

jalalmousa_0-1674760908810.png

in both cases it will be hard to achieve closed polyline or create regon

 

 

0 Likes
Message 6 of 6

Ed__Jobe
Mentor
Mentor
Accepted solution

Here is what help says:


VBA Reference for AddPolyline wrote:

Remarks

To create a polyline containing arcs, first create the straight polyline, and then set the bulge at specific vertices using the SetBulge method.

This method exists for backward compatibility only. Use the AddLightweightPolyline method to create polylines with an optimized format that saves memory and disk space.


The only option is to use the SetBulge method. See that topic for how to calculate the bulge factor.

I'm still a little curious how you are getting the point list if the pdf is just an image.

 

As a side note, you are referring to an "arc", not "arch".

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes