henrik.jonsson Posted February 20, 2009 Posted February 20, 2009 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 Quote
darn-net Posted February 20, 2009 Posted February 20, 2009 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" Quote
henrik.jonsson Posted February 20, 2009 Author Posted February 20, 2009 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 Quote
darn-net Posted February 20, 2009 Posted February 20, 2009 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. Quote
henrik.jonsson Posted February 20, 2009 Author Posted February 20, 2009 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 Quote
henrik.jonsson Posted February 20, 2009 Author Posted February 20, 2009 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 Quote
JohnM Posted February 20, 2009 Posted February 20, 2009 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 Quote
darn-net Posted February 20, 2009 Posted February 20, 2009 I've attached two code examples from the AC help file combined into a txt file. help examples Select and Polyline Offset.txt sorry I couldn't be of more help, good luck Quote
henrik.jonsson Posted February 21, 2009 Author Posted February 21, 2009 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 Quote
Recommended Posts
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.