fabcad Posted April 8, 2022 Posted April 8, 2022 Hello fellow lispers, I am trying to create a routine which allows to create street names in Mtext objects according to a choice of 3 solutions. 1- Select the reference text to be multiplied. 2- Select the linear (PLINE or LINE) serving as a reference for the creation. 3- Creation of the textual Mtexts according to the chosen solution. I have a question when the start and end points are reversed when creating the line or pline for the correct justification of the street Mtexts. Attached is a screenshot and my almost finished routine. Thank you in advance, Ecrire_NomsVoies_1a3.lsp Quote
Steven P Posted April 8, 2022 Posted April 8, 2022 So kind of struggling with French lessons from 30 years ago for your LISP... but you have been good to ask the question in English, I'll have a go at an answer. Unless I am wrong your first point and last point of the lines are point_debut_lineaire point_fin_lineaire if the line is drawn in reverse, can you swap these over so that point_debut_lineaire becomes point_fin_lineaire.. and in which case all you need to do is an if routine for the smallest x coordinate to be point_debut_linear ? (about line 385) Something like (if (< (nth 0 point_fin_lineaire) (nth 0 point_debut_lineaire) ) (progn (setq temp point_fin_lineaire) (setq point_fin_lineaire point_debut_lineaire) (setq point_debut_lineaire temp) ) ;end progn ) ;end if obviously I might be wrong. 1 Quote
ronjonp Posted April 8, 2022 Posted April 8, 2022 Here too: http://www.theswamp.org/index.php?topic=57497.0 1 Quote
fabcad Posted April 8, 2022 Author Posted April 8, 2022 Thank you for your answers, I now have leads to complete my program. I apologize for the writing in French of the comments of my lisp program. Good evening to you. Quote
Steven P Posted April 8, 2022 Posted April 8, 2022 10 minutes ago, fabcad said: I apologize for the writing in French of the comments of my lisp program. That's not a problem, your LISP, make the comments so you can understand it Quote
BIGAL Posted April 9, 2022 Posted April 9, 2022 I use a pick line near start end method you compare the pick point to the start and end points so flip the line if required. (SETQ TP1 (entsel "\nSelect Line near left end: ")) ; implies which way for holes (setq tpp1 (entget (car tp1)) p1 (cdr (assoc 10 tpp1)) p2 (cdr (assoc 11 tpp1)) p3 (cadr tp1) ) (setq d1 (distance p1 p3) d2 (distance p2 p3) ) (if (> d1 d2) (progn (setq temp p1) (setq p1 p2) (setq p2 temp) ) ) Quote
mhupp Posted April 10, 2022 Posted April 10, 2022 On 4/8/2022 at 12:00 PM, Steven P said: Unless I am wrong your first point and last point of the lines are point_debut_lineaire point_fin_lineaire if the line is drawn in reverse, can you swap these over so that point_debut_lineaire becomes point_fin_lineaire.. and in which case all you need to do is an if routine for the smallest x coordinate to be point_debut_linear ? (about line 385) That is basically what i did over on the swamp. Checked to see if the line was going left to right or right to left. also used to set the right angle so text is upright (if (setq OBJ (car (entsel "\nSelect line"))) (progn (setq PT1 (vlax-curve-getStartPoint OBJ) PT2 (vlax-curve-getendpoint OBJ) MPT (mapcar '/ (mapcar '+ PT1 PT2) '(2 2 2)) dist (distance PT1 PT2) ) (if (< (car PT1) (car PT2)) (setq ang (angle PT1 PT2) x PT1 y PT2 ) (setq ang (angle PT2 PT1) x PT2 y PT1 ) ) ) ) 1 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.