Message 1 of 7
OFFSET THRU POINT finally working

Not applicable
02-21-2009
09:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
VBA entity.offset works with a positive or negative distance, but how to figure out the sign?
The normal command-interface is easy: just point which side or (more important) point an entity.
How to simulate this in VBA? Well, run a Lisp-routine.... Easy, yes, but.... each entity has a handle, so you can SendCommand "(setq e (handent " & chr(34) & e.handle & chr(34) & "))" & vbCr , so now you have Lisp-var "e" .
Through a point? This one is tricky, but also stupidly easy: watch the fraction-sign: is it a "." or a "," !! In AC one uses the point-notation as in VBA-strings!!! it is a "," (comma), so clean up with pt(0)=Replace(.coordinates(0),".","") and pt(0)=Replace(pt(0),",","."). Now you can SendCommand "(setq pt (" & pt(0) & " " & pt(1) & " " & pt(2) & "))" & vbCr
Now perform the sendcommand "Offset" & vbCr & "T" & vbCr & e & vbCr & pt & vbCr & vbCr
Don't forget to clean up the lisp-vars: sendcommand "(setq e nil pt nil)"& vbcr
One of the nice things is thjat you can check if a point is "Inside" a circle or close polyline!!
The normal command-interface is easy: just point which side or (more important) point an entity.
How to simulate this in VBA? Well, run a Lisp-routine.... Easy, yes, but.... each entity has a handle, so you can SendCommand "(setq e (handent " & chr(34) & e.handle & chr(34) & "))" & vbCr , so now you have Lisp-var "e" .
Through a point? This one is tricky, but also stupidly easy: watch the fraction-sign: is it a "." or a "," !! In AC one uses the point-notation as in VBA-strings!!! it is a "," (comma), so clean up with pt(0)=Replace(.coordinates(0),".","") and pt(0)=Replace(pt(0),",","."). Now you can SendCommand "(setq pt (" & pt(0) & " " & pt(1) & " " & pt(2) & "))" & vbCr
Now perform the sendcommand "Offset" & vbCr & "T" & vbCr & e & vbCr & pt & vbCr & vbCr
Don't forget to clean up the lisp-vars: sendcommand "(setq e nil pt nil)"& vbcr
One of the nice things is thjat you can check if a point is "Inside" a circle or close polyline!!