Jump to content

Automatic writing of street names with justification of street Mtexts


fabcad

Recommended Posts

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_FR_enrichi.png

Ecrire_NomsVoies_1a3.lsp

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
    )
)

 

Link to comment
Share on other sites

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
      )
    )
  )
)

 

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...