Jump to content

AcadObject.Offset in VBA


Recommended Posts

Posted

Hi

 

I just made a macro to automatically offset a closed polyline.

The Offset command should offset outside the original polyline. With different files I get different result but I can't se any difference.

With one DWG file a positive offset value gives me an outside offset but with another DWG file an inside offset is created.

 

Anyone with experience of this or some hint of what to do?

 

 

best reguards

Henrik

Posted

Maybe you are having the same problem? Try turning off Running OSNAPS.

 

I'm unsure if this will help, but I have a lisp program that draws a polyline slot. It prompts:center,radius,center,radius. If I don't turn off the running OSNAPS with a F3 key before entering the last radius, I get unexpected results which I assume it's picking an osnap point.

 

One day I hope to edit my slot.lsp code to fix this. Maybe tomorrow I'll stop procrastinating. :)

 

Dave

"Most of what I know came from the "F1" key"

Posted

I tried but it didn't help.

 

The strange thing is, if I draw a brand new Polyline on top of the other on even the same layer it works fine.

I just cant figure out whats so special with the polyline already there.

 

About your LSP. You know that you can save OSNAPMODE, do your slot thing, and then put OSNAPmODE back to what it was before.

 

/Henrik

Posted

Polylines have a start and an end. Possible that it is selecting start of both? So to say, if start is horizontal line on top of one and bottom off other and your code selects a point above start of both. One would offset inside, outside on other.

Posted

Well I will check that as a difference but..

I don't pick the object. I select it as the drawings only polyline on a specific layer.

 

/Henrik

Posted

If I draw the polyline counterclockwise the offset command works as it supposed to (refering to the F1 help).

 

So I just need to determine which way it's drawn and put a positive or negativ value.

 

I'll do som mote test before. Thanks for all your help.

 

/Henrik

Posted

I found that the further away from 0,0 you get, the more unstable the offset function is.

This is an AutoCAD bug and is well know but there are no fixes for it. I use vla-offset in a few of my programs and I just have to remember to keep things close to home

Posted

Hi

 

I have found that if I calculate the area of a polygon I get a negative value if the vertex order is in clockwise ordering and negative if they are in positive ordering.

 

Then I can deside weather to use a positive value or not for the offset command.

 

/henrik

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...