Jump to content

Recommended Posts

Posted

Hi Lisp Expert,

 

I need a help on my lisp code here.

 

Context: I work as surveyor, everyday the lads goes collect informations on site and bring to me. After process the data, when I open the DWG, every text levels are in a distance of 0.473 and I need click in every object in a different layer, and use the command "SELECTSIMILAR", then I move to the point.

 

I was trying to create a lisp routine that when using the "movetopoint" command, all texts with the configuration "X.XX", "XX.XX" or "XXX.XX" where X is a number, are shifted (offset) from where they are to -0.473, both horizontally and vertically. Without me having to select the reference point.

 

That's the lisp that I create.

 

Quote

(defun c:movetopoint (/ ss)

  (setq ss (ssget "_X" '((0 . "TEXT") (1 . "*?.[0-9]?[0-9],[0-9][0-9],[0-9][0-9]"))))

  (if ss

    (progn

      (command "_.MOVE" ss "" "_non" "_non" '(0.0 0.0 0.0) '(0.473 0.473 0.0))

      (princ "\nTexts successfully moved!")

    )

    (princ "\nNo text found.")

  )

  (princ)

)

 

 

I'm not sure, but I think that the filter isn't good.

 

I tried some different ideas, like:

Quote

(ssget "_X" '((0 . "TEXT") (1 . "*?.[0-9]?[0-9],[0-9][0-9],[0-9][0-9]")))

 

Quote

(setq sel (ssget "_X" '((0 . "TEXT") (2 . "X.XX,XX.XX,XXX.XX"))))

Quote

(setq sel (ssget "_X" '((0 . "TEXT") (1 . "*[0-9]*\\.?[0-9]*"))))

 

 

Quote

(ssget "_X" '((0 . "TEXT") (1 . "*.[0-9]?[0-9][.,][0-9][0-9]")))

 

 

Can someone help me with that task?

 

Kind regards,

Rodrigo Brígido.

Posted

As a quick idea,

 

IF you can't get the filter to work I am sure I saw a LISP out there somewhere that will check if a string is a number of apha-numerical string.

 

So you could grab all the text and loop through it to check each if they are in the correct format, maybe with a wcmatch or something? or find a checking LISP, remove them from the ss if not suitable and then move the whole lot after

Posted

Not sure, but this : "X.XX", "XX.XX" or "XXX.XX" reminds me to : "#.##", "##.##" or "###.##"

Posted (edited)

What software are you using for the import points, should be able to fix the offset there, if CIV3D labels they have massive amount of variations but can be edited.

Edited by BIGAL
  • Like 1
Posted

Steven P

 

;(cond
(type ExcelValue) 'INT) 
(type ExcelValue) 'REAL) 
(type ExcelValue) 'STR) 

if str then maybe look for a chr 0-9

 

  • Like 1
Posted
18 hours ago, marko_ribar said:

Not sure, but this : "X.XX", "XX.XX" or "XXX.XX" reminds me to : "#.##", "##.##" or "###.##"

Omg, sometimes we focus so much on the trees and forget about the branches. This idea of replacing the X with # worked perfectly. 

 

Thank you

Posted
8 hours ago, BIGAL said:

What software are you using for the import points, should be able to fix the offset there, if CIV3D labels they have massive amount of variations but can be edited.

In my case, we use Leica/Trimble (R8, R10, R12) data on Liscad, then we import as DXF to combine all files. Liscad haven't the settings to change the text displacement 

Posted
9 hours ago, BIGAL said:

Steven P

 

;(cond
(type ExcelValue) 'INT) 
(type ExcelValue) 'REAL) 
(type ExcelValue) 'STR) 

if str then maybe look for a chr 0-9

 

 

Yes, if you are selecting text it will all be returned as a string, so need that 2nd check

 

(defun c:test ( / str )
  (setq str  (cdr (assoc 1 (entget (car (entsel "Select Text"))))))
  (princ (type str))
)

 

Posted (edited)

Have you thought about Stringer or Civil Site Design works inside Civ3D or Bricscad. So imports data from total station. Stringer as name implies, strings, makes surfaces etc

 

image.png.82546ffbef8709fb8e2400dd21522335.png

Edited by BIGAL

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