Jump to content

Recommended Posts

Posted

Hy!

 

I have to draw perpendicular lines in an arc from A and B dots.

Here an illustrative drawing:

 

h t t p://kepfeltoltes.hu/100316/pelda_www.kepfeltoltes.hu_.png

 

I should draw the green lines with AutoCAD macro (with VBA, not Lisp).

A and B dot and the polyline is known.

Can somebody help with his problem solution?

Ahead thank you for the answer!

(Excuse me because of the weak English language knowledge)

Posted

Serach forum here for "perpendicular" "batter" lots of code examples VBA & Lisp

 

Else explode polyline and select objects a bit easier to handle in terms of code.

Posted
Serach forum here for "perpendicular" "batter" lots of code examples VBA & Lisp

 

Else explode polyline and select objects a bit easier to handle in terms of code.

 

I did not find a similar example unfortunately, how may be draw a perpendicular line to an arc.

 

Does not exist onto this some kind of mathematical formula? AutoCAD figures out where he has the perpendicular line endpoint somehow.

Posted

A line can only be perpendicular to an arc if a line goes through or would extend to the centre point.

 

hence you need to find the arc details in particular centre pt then run a line from that to your point and extend to see if it hits the arc. You need to check the angle of the projected line is within the start and end angles if so then just draw a line from the centre at the new angle for the radius distance this gives "lastpoint" erase line and now draw line from your point to lastpoint

Posted
Look a bit more found this a few lines down from your post

 

http://www.cadtutor.net/forum/showthread.php?t=45876

 

Thanks this was useful help! The linked post the centre of the arc is found on his basis, so actually his perpendicular line vector. How can I define the intersection of the perpendicular line and the polyline (arc)?

 

Actually between the centre dot and the granted dot it would be necessary to extend a drawn line until the polyline. Possibly, if it is possible to solve this with EXTRUDE command, how I can do it with VBA?

 

Ahead thank you for the answer!

Posted

Heres some vba code for calculating an intersection between an arc an another object this case a polyline

 

Set arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang)

 

this creates a arc in your case you would know the arc details hence "arcobj"

 

probably change something like this to be a line from centre to your point for opoly

 

ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :"

 

retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity)

 

This extends a line etc and returns retval2 if its nil then the line missed else returns the point.

 

Hope this helps

Posted
Heres some vba code for calculating an intersection between an arc an another object this case a polyline

 

Set arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang)

 

this creates a arc in your case you would know the arc details hence "arcobj"

 

probably change something like this to be a line from centre to your point for opoly

 

ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :"

 

retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity)

 

This extends a line etc and returns retval2 if its nil then the line missed else returns the point.

 

Hope this helps

 

Thank you very much, works perfectly, I was able to define all of the data of the perpendicular lines. I have a "tinier" problem on the other hand yet:

 

Let us assume that a M is the perpendicular line's dot that intersect the polyline. For example an arc. The coordinates of this dot are given. I would like to break the polyline in this dot, two sections arise so. I would need the length of these sections.

I did not find the BREAK AT POINT command nowhere in the VBA.

 

You would be able to help this problem?

 

Thank you! :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...