macros55 Posted June 5 Author Posted June 5 Mr. @Tsuky, Yes, I used that code. For example please check this area, coordinate x,y 2517.9362,642.7231 Quote
Tsuky Posted June 5 Posted June 5 Indeed, this is due to the polyline segment which is not perfectly parallel to the orientation of the text. What you can try to do is increase the tolerance at line 100. For exemple: (if (equal (rem (angle (car l_vtx) (cadr l_vtx)) pi) (rem ang pi) 7E-02) If this is not enough, increase further within reason. Quote
BIGAL Posted June 5 Posted June 5 For Tsuky working on it. Busy working on a house reno. "Some points have been added in the opposite direction. What could be the reason for this?" one of the things I was looking at was the direction of the drawn pline, if you say put a point on end of pline it may be wrong end, as I am still working on it not sure if lines are consistent direction. Will find if a problem. Quote
macros55 Posted June 6 Author Posted June 6 Gentlemen, From what I understand, LISP always adds a dot to the start point of the line. Is it possible to add point to the end of the Pline that is farthest from Text? Is it possible to solve this problem like this? Quote
BIGAL Posted June 6 Posted June 6 (edited) Ok 1st go 1431 text objects about 2 seconds to change, as per 1st sample dwg supplied. The little search window can be done better. Ver 2. Entmake a point speed increase also. ; Modify a pline with text above by Alan H. June 20204 (defun c:tpoint ( / ss ss2 start end x obj obj2 pt1 pt2 pt3 pt4) (command "-layer" "M" "GPoint2" "C" 5 "" "M" "GLine2" "C" 2 "" "M" "GText2" "C" 1 "" "") (prompt "Select text to change ") (setq ss (ssget '((0 . "TEXT")))) (if (= ss nil) (progn (alert "No text selected will now exit")(exit)) ) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq ins (vlax-get obj 'insertionpoint)) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pt1(vlax-safearray->list minpoint)) (setq pt1 (mapcar '+ pt1 (list -0.5 -0.5 0.0))) (setq pt3 (vlax-safearray->list maxpoint)) (setq pt3 (mapcar '+ pt3 (list 0.5 0.5 0.0))) (setq pt2 (list (car pt3)(cadr pt1))) (setq pt4 (list (car pt1)(cadr pt3))) (setq lst (list pt1 pt2 pt3 pt4 pt1)) (setq ss2 (ssget "CP" lst '((0 . "LWPOLYLINE")))) (if (= ss2 nil) (princ) (progn (setq obj2 (vlax-ename->vla-object (ssname ss2 0))) (setq start (vlax-curve-getstartPoint obj2)) (setq end (vlax-curve-getEndPoint obj2)) (vlax-put obj 'Layer "GText2") (vlax-put obj2 'Layer "GLine2") (setvar 'clayer "GPoint2") (command "point" start) ) ) ) (princ) ) (c:tpoint) Edited June 6 by BIGAL Quote
BIGAL Posted June 6 Posted June 6 (edited) Macros55 the answer to the question of point at wrong end may be solved simply, by answering this question, if these text and plines are generated in some way why are some drawn in reverse direction ? Are you using a lisp to generate them ? That lisp needs to be corrected so line always goes in correct direction. Looks like a MIrror function that needs a Pedit Reverse if implemented. Edited June 6 by BIGAL Quote
Tsuky Posted June 6 Posted June 6 4 hours ago, macros55 said: Gentlemen, From what I understand, LISP always adds a dot to the start point of the line. Is it possible to add point to the end of the Pline that is farthest from Text? Is it possible to solve this problem like this? Here is the test that seems to solve the point placement problem. (if (equal (rem (+ 0.01 (angle (car l_vtx) (cadr l_vtx))) pi) (rem (+ 0.01 ang) pi) 7E-02) So this tests the angle (in radians) of the polyline segment and the orientation of the text. The presence of (+ 0.01) is to allow the passage of an angle slightly lower than PI:4th quadrant to the 1st quadrant. REM is used to compare the angle from 0 to PI EQUAL to have a close tie at 0.07. After a quick observation of the drawing after execution, the points seem well placed, but I was able to miss a poorly placed point... Quote
macros55 Posted June 6 Author Posted June 6 (edited) Gentlemen, you are truly amazing). Mr. Tsuky and Mr. Bigal, thank you very much. I really respect the effort you put in. Edited June 6 by macros55 Quote
BIGAL Posted June 7 Posted June 7 (edited) I was going to add a point end check may do so, you can get a fuzzy midpoint of text and compare distance to the 2 ends the longer distance is correct point, must have known something left start and end points in code. Edited June 7 by BIGAL Quote
ronjonp Posted June 7 Posted June 7 (edited) Sorry but his logic kills me (if (= ss2 nil). as opposed to ( if ss2 . As in is it equal to nothing or is it nothing. Edited June 7 by ronjonp Quote
BIGAL Posted June 7 Posted June 7 (edited) Speed and more speed, your home work is change the (command "point" pt) to a entmake function, just did 1590 text checks and with code change was like blink and you missed it ALL DONE. Took longer to select and press enter than convert. Maybe get a 2nd Hamster for the power wheel. Double the power. Edited June 7 by BIGAL 2 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.