comet712 Posted October 10, 2017 Posted October 10, 2017 Hi, I'm looking for a routine where I can have auto dimension from multiple selected points to a line perpendicular to the points. Thank you in advance. Dimension from Point to line.dwg Quote
BIGAL Posted October 10, 2017 Posted October 10, 2017 Here is a start for you, change the line to a dim command, next step is to pick all points and do in one go. Please have a go at modifying. (setq oldsnap (getvar 'osmode)) (setq obj (vlax-ename->vla-object (car (entsel "\nPick line object")))) (while (setq pt (getpoint "pick point")) (setq pt2 (vlax-curve-getClosestPointTo obj pt acextendnone)) (setvar 'osmode 0) (command "line" pt pt2 "") (setvar 'osmode oldsnap) ) Quote
comet712 Posted October 12, 2017 Author Posted October 12, 2017 Hi BIGAL, Thank you for your reply. However I have no background on LISP Programming. I have tried my best to modify by changing the line to dim command as below. Still couldn't get it working though. Would you mind pointing out where went wrong? (defun c:try2 () (setq oldsnap (getvar 'osmode)) (setq obj (vlax-ename->vla-object (car (entsel "\nPick line object")))) (while (setq pt (getpoint "pick point")) (setq pt2 (vlax-curve-getClosestPointTo obj pt acextendnone)) (setvar 'osmode 0) (command ".DIMLINEAR" pt pt2 "") (setvar 'osmode oldsnap) ) ) Quote
BIGAL Posted October 13, 2017 Posted October 13, 2017 Very simple fix dim expects an offset point so (command ".DIMLINEAR" pt pt2 pt ) Quote
Kumar1 Posted Wednesday at 12:33 PM Posted Wednesday at 12:33 PM auto dimensioning by selecting multiple points and one line object Quote
devitg Posted Wednesday at 03:48 PM Posted Wednesday at 03:48 PM 3 hours ago, Kumar1 said: auto dimensioning by selecting multiple points and one line object @Kumar1 please upload a sample.dwg with, at least, 2 o3 dim as you need it to be Quote
Kumar1 Posted yesterday at 09:20 AM Posted yesterday at 09:20 AM On 10/17/2017 at 3:00 PM, comet712 said: Thanks BIGAL! this lisp is fine, but instead of picking each point, can we write a lisp routine to select multiple points and write dimension automatically. Quote
Kumar1 Posted yesterday at 09:56 AM Posted yesterday at 09:56 AM 18 hours ago, devitg said: @Kumar1 please upload a sample.dwg with, at least, 2 o3 dim as you need it to be this lisp is fine, but instead of picking each point, can we write a lisp routine to select multiple points and write dimension automatically. Sample File uploaded above. Quote
devitg Posted 23 hours ago Posted 23 hours ago 5 hours ago, Kumar1 said: this lisp is fine, but instead of picking each point, can we write a lisp routine to select multiple points and write dimension automatically. Sample File uploaded above. @Kumar1 please make or send a real dwg , with points-layer, line-layer, dim-layer and a new dimstyle not an overrided style, so all variables system are stated . Like the first DWG posted at this topic Dimension from Point to line.dwg Quote
pkenewell Posted 22 hours ago Posted 22 hours ago (edited) Here is a boiled down simple version with no error testing. It assumes that the dimensions will run on the same angle as the angle between the point and the curve segment: ;; Created by P. Kenewell 1/22/2026 (defun c:dim2pts (/ ep i p1 p2 p3 ss) (if (and (progn (princ "\nSelect Points to Dimension: ") (setq ss (ssget '((0 . "POINT,INSERT")))) ) (setq ep (entsel "\nSelect a curve to Dimension to: ")) ) (repeat (setq i (sslength ss)) (setq p1 (cdr (assoc 10 (entget (ssname ss (setq i (1- i)))))) p2 (vlax-curve-getclosestpointto (vlax-ename->vla-object (car ep)) p1) p3 (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)) ) (command "._dimrotated" (* (/ (angle p1 p2) pi) 180.0) "_non" p1 "_non" p2 "_non" p3) ) ) (princ) ) Example Screenshots: Edited 15 minutes ago by pkenewell Removed unnecessary (progn...). Updated point selection to include Block References. 2 Quote
Kumar1 Posted 1 hour ago Posted 1 hour ago Auto dimensiong - Project 1.dwg dimensions to be added as shown in the dwg by selecting multiple points and lines near by. Quote
Kumar1 Posted 58 minutes ago Posted 58 minutes ago 28 minutes ago, Kumar1 said: Auto dimensiong - Project 1.dwg dimensions to be added as shown in the dwg by selecting multiple points and lines near by. dimension to be perpendicular to the lines nearby Quote
pkenewell Posted 20 minutes ago Posted 20 minutes ago (edited) @Kumar1 I'm afraid your not going to get a completely automated solution. It might be possible, I'm not sure, but would take a great deal more code to sort and determine the closest curves. This is something I don't have time to write for you. The solution I gave you works if you select the points, then the curve for each set of dims. I leave it to you to sort out what you want from our examples. P.S. Some of your "points" are actually block references, you should better represent what you want. I am updating the code above to include block references, which will get their insertion point.. Edited 16 minutes ago by pkenewell 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.