AutoCAD Visual LISP / AutoLISP :: Trim Selected Text(s) With A Divisor?
Feb 2, 2013
I need a program to trim selected text(s) with a divisor.
suppose that the divisor character is: "/"
(selected text==>result
textL/textR ==> textR
xxx/yyy ==>yyy
t12x/5678 ==>5678
I should use some commands like:
;;;;div="/":
(setq str "xxx/yyy")
(setq pos (vl-string-position (ascii "/") str))
(setq len (strlen str))
(setq RGT (substr str (+ pos 2) (-(- len pos)1))) ;;=text after "/"
but I need a LISP program that:
1-ask user to give a divisor char: (Divisor character: </>)
2-ask user to select text(s) but program should filter selected text(s) with divisor (*/* pattern)
(if (null #div#)(setq #div# "/"))
(if (and
(setq #div# if (= (setq tmp (getstring (strcat "
Divisor character: <" #div# "> ") ) ) "" ) #div# tmp ) )
(setq ss (ssget "_:L" (list '(0 . "*TEXT") (cons 1 (strcat "*" #div# "*")))))
)
View 5 Replies
ADVERTISEMENT
Nov 14, 2012
I need a LISP program that prompts: "select text(s)" then I select for example 100 text in open drawing file.
after that this program creat a file (LIST.CSV) and write each selected text in line by line of this file:
result text file (LIST.CSV ) should be:
Text1
Text2
Text3
...
...
Text99
Text100
ofcourse Text1 is the content of a text object.
View 9 Replies
View Related
Oct 25, 2012
A program that prompts:"select objects:" then I can select some objects like as text, line, circle,... after that program find all texts in selected items and swap text
swap means: xxx/yyy ===> yyy/xxx ; "/" is a divisor
swap function for one text is here:
(defun c:swap ( / pos ent el txt)
(vl-load-com)
(if(null #div#)(setq #div# "/"))
(setq #div#
(if(=(setq tmp(getstring(strcat "
Divisor character: <"#div#"> ")))"")
#div# tmp
)
[Code]....
but I want a program to prompt me like this:
(prompt "Select objects:")(terpri)
(setq a (ssget '((0 . "TEXT"))))
and gets divisor char </>:
after that:
(setq n (sslength a))
(repeat n
....
)
repeats n times, n=number of texts in my selection
View 6 Replies
View Related
Nov 13, 2012
I’m trying to put together a loop for if nil or something other than text or mtext is accidentally selected than prompt text was not selected. This is what I have so far.
text or mtext is not selected than prompt
(defun C:ww ()
(while
(not
(and
(setq esel (entsel "
[Code]......
View 7 Replies
View Related
Jan 17, 2013
I have a little routine to add two selected numerical texts together and show the result at a selected position. I am using the entsel method to select them. I would like a way to highlight the selected text temporarily. Is this possible. The routine is as follows.
(defun c:T+ ( / Txt1 Txt2 Txt3 Pkt )
;Adds second selected number to first
(setvar "dimzin" 3)
(setq curlay (getvar "clayer"))
(setq curcol (getvar "cecolor"))
(setq curlin (getvar "celtype"))
(setq ds (getvar "dimscale"))
[code]....
View 3 Replies
View Related
Jan 24, 2013
I need a LISP program to add a text given by user to all selected text.
in other words:
1- user selects some texts.
2- user give a text to program.
3- Program added this text to all selected text.
selected text: text1, text2, text3,text4,....,textn
given text by user: _xyz
Result:
text1_xyz, text2_xyz, text3_xyz,text4_xyz,....,textn_xyz
View 6 Replies
View Related
Jun 2, 2004
lisp routine that will add together the values of text entities? For instance, if I have a big parking lot and each section is labeled with the number of spaces, I could pick the texts and it would add all the numbers together to give me a total. Right now I export to excel to do this. I have quite a few situations where this would be handy, not just for parking spaces, so I really just want a lisp that will add all my selected numbers.
View 9 Replies
View Related
Apr 5, 2013
I have very little knowledge in complex Autolist routines and routine to do the following:
I would like to be able to provide a Prefix and/or Suffix via dialog then pick any line of text or multiple lines of text and have it concentrate. For example: Prefix: First Floor Suffix: M100. I pick the room text on an arch floor plan "Mechanical room" and the second line "100" The result will be "First Floor Mechanical room 100 M100".
But lets take it a final step further; once condensed, I want it added to a perticular tag attribute in a block I inserted.
Example of how I would use it. I insert a symbol for an addressable smoke detector that has several tags; one of them being Location. I would use this routine to gather the information provided by the Arch floor plan and join it with the block attribute for exporting later for use in the Fire Alarm Panel Programming.
attached is a sample block with the attributes.
View 9 Replies
View Related
Dec 29, 2011
the expression in question is part of larger lisp routine to create and rotate text based on the object selected and the viewtwist variable (we use dview twist to rotate our views when needed)
So the expression in question:
(< (/ pi 2) ang (* pi 1.5)
where ang is the total angle used to determine proper rotation of the text.
Now the problem. In most cases where ang = 90 (or 1.5708 radians) this works fine. the two exceptions i have encountered
in testing are a line at 70 degress, viewtwist 20, and line at 50, viewtwist 40. For whatever reason at these two conditions the expressoin evaulates True instead of nil and rotates the entire text object incorrectly (180 degrees). So question is how exactly is this being evaluated? i know its comparing ang (* pi 1.5) to (/ pi 2). is there some sort of rounding error? or maybe the expression needs a wee bit more definition? attached image and full lisp routine for reference of what is happening, blue text is angle of the line as created by routine at viewtwist 0.
View 1 Replies
View Related
Jul 15, 2013
I've been looking to download a lisp that can trim (TR) and the (PE, join) polylines. two at a time or multiple... I've tried writing the lisp routine but I cannot do it correctly.. Any good lisp routine? Also, if there's one to trim & fillet w/a radius.. Hopefully there's two different routines but if there's one then even better...
View 6 Replies
View Related
Oct 8, 2013
I've been looking for a lisp program. I've tried to mix-and-match code to come up with a working lisp but nothing is working. I am using a polyline rectangle to start with, offsetting it out 0.75 outward, and triming everything outside of the offset and erasing the offset.
View 9 Replies
View Related
Jan 9, 2013
This is to trim a line that crosses another. I draw lots of plumbing plans. It draws a circle based on 'dimscale', trims a line to that circle, then erases the circle. The problem is if you miss the trim point (PT2) it does not erase the circle and you lose your object snaps.
;Pipeline Break
(Defun C:bb (/ s1 ds1 r1 PT1 PT2 AX)
(setq s1 (getvar "osmode"))
(setq ds1 (getvar "dimscale"))
(setvar "osmode" 63)
(setq r1 (* ds1 0.03125))
(setq PT1 (getpoint "
[code]....
View 9 Replies
View Related
Jan 1, 2014
I need a LISP that create a new layer and ask me for the name and the other properties (color,lw,lt..).
ask me if I want move the selected object for the new layer (yes is the default value)
View 9 Replies
View Related
Oct 18, 2012
Any way to detect of there are objects currently selected using Autolisp, visual lisp or even VBA. I would like to be able to do something using that as a conditional, so that (assuming the hypothetical variable isSelected is an on/off indicator of whether or not something is selected) I can code something like this:
(if (isSelected) (...))
View 4 Replies
View Related
Nov 23, 2012
I need a program to move some selected text to a line something like as extend command but for text objects!
suppose that there is a horizental line (y=constant) or vertical line (x=constant) and some selected text(or other objects), I want a lisp program that move these selected text (or objects) by their "insertion point" to this line.
in other word, if the selected base line is horizental (y=constant) then property of "Y" of all selected text should change to line's "Y"; and if selected base line is vertical (x=constant) then value of "X" of all selected text should match to line's "X" value.
for example, for base vertical line (x=constant) and 3 selected text(or can be any object) result is:
text1. | text1.|
text2. | ===> text2.|
text3. | text3.|
| .text1 |.text1
| .text2 ===> |.text2
| .text3 |.text3
View 9 Replies
View Related
Nov 30, 2012
i have found the following lisp in a previous thread: (shows XY coordinates of the selected blocks)
(defun C:MyFunc (/ ss Index Ename Lst)
(while (or (not ss) (= 0 (sslength ss))) (setq ss (ssget '((0 .
"INSERT")))))
(if ss
[Code]....
I want this information to be added to the blocks as hidden attributes so that i can extract them by attout. The work to be done is : attout to excel, autofill an attribute (numbering) then attin.
but my problem is that i cant think of a way to number those blocks IN ORDER (ie top to bottom or left to right) unless by sorting them in excel first by their x or y coordinates
View 9 Replies
View Related
Apr 1, 2012
I need to convert a lot of different hatches to solid hatches.
I haven´t found a way to do it in Autocad 2012.
script that cycles to all selected hatches and change the properties to solid?
View 4 Replies
View Related
Aug 7, 2013
Using Nentsel function, I can get info on a object that is nested with an Xref. Is there a way to move the selected object using ObjectDBX?
View 9 Replies
View Related
Jan 25, 2013
I wish to have a lisp than enable to do automatic offset base on some selection of lines ,circles or polylines object as shown in attachment.
View 9 Replies
View Related
Jun 3, 2013
How to make a lisp command that will select all objects in the drawing?
View 3 Replies
View Related
Sep 9, 2011
I thought this would be a simple tblsearch process, but as far as I can tell, there isn't a tblsearch symbol table for vplayer settings, so I need to get more creative I guess.
I want to be able to get the vplayer color of a selected object as part of a larger routine I'm putting together.
View 8 Replies
View Related
Jun 12, 2013
I found a lisp for counting of selected block in a table drawing, but I can not remove the bottom line of this lisp that displays "total" blocks. How to remove this line from "total" that is created in the last row of the table that lisp.
lisp : ========================================
(defun c:TABL (/ blk_id blk_len blk_name blks ent h header_lsp height i j TOTAL
len0 lst_blk msp pt row ss str tblobj width width1 width2 x y
)
[Code]....
View 4 Replies
View Related
Aug 15, 2013
I think there is a function that will cause the selected object that is in the XRef to highlight.
View 1 Replies
View Related
Jul 17, 2013
I having real difficulty finding a lisp that will find and replace blocks. There are plenty out there and AutoCAD 2013 and lower has a Find and Replace Blocks. However, the frustrating catch is I can seem to find a routine that will allow me to replace only those blocks that I select with a selection set of my choosing. The built in function replaces all of them and will not let you exclude some. We have PID drawings that we want to replace valves on, but not all valves. We don't want to rename. We don't need to BEDIT the existing block.
1) Pick group of blocks
2) specify a new block that will replace all instances of old block
3) replace inserted block with different block. Leaving others alone.
I'm thinking this should be easy, but my search has failed. The blocks in question are not dynamic or attributed either.
View 3 Replies
View Related
Jul 29, 2013
When i export revit drawing with revit family
the revit family become block in autocad like this
M_Single-Flush - 700 x 2200mm-278353-Ground Level _0_45
usually i want to remove the ID and view name to become like this without have to re type because it is tedious
M_Single-Flush - 700 x 2200mm
something like how many letters you want to remove from last to first ?
or something better like remove this last two dash and the letters embedded inside ( that separate name-ID-View name) -278353-Ground Level _0_45?
View 9 Replies
View Related
Nov 13, 2011
i.e. it would be usefull for separating the top and bottom of a sheet metall or plastic part.
Other cad systems I have seen have a function to do this automatically....
View 9 Replies
View Related
Dec 2, 2010
I need a lisp routine which will delete all the dimensions inside selected block or blocks, including nested blocks inside.
View 9 Replies
View Related
Feb 27, 2013
How can I draw a The smallest rectangle enclosing for a selected set of objects in current drawing?
View 9 Replies
View Related
Mar 1, 2012
Is there a way to determine the type of ACAD object that the user selected? I need to retrieve the value from either a dimension or text. The info could be in either format so the lisp routine needs to determine what was selected so the correct vla-get command is used.
Once I determine what the object is I can use an if statement to retrieve the value.
;user selects the object
(setq dimobj (vlax-ename->vla-object(car(entsel))))
;If ACAD object is a dimension do this.
(setq dimvalue (vla-get-textoverride dimobj))
;If ACAD object is text do this.
(setq dimvalue (vla-get-textstring dimobj))
View 4 Replies
View Related
May 13, 2013
I am trying to write a program to align a block with two selected destination points.
- first the user is prompted to select a lwpolyline of a block entity
- then he is prompted to pick two destination points
I face problem with the sub-routine SegmentPts. It is supposed to return the coordinates of two vertexes on both sides of the picked point on a lwpolyline using entsel. But here in my program, when i am picking a point using entsel on a lwpolyline inside a block entity, it is not returning the two vertexes on both sides of the picked point. In stead, it returns some other points of the selected LWPOLYLINE. Why it is doing so? Where is the problem in my program?
It works fine with my other programs where i pick on a LWPOLYLINE entity. In this particular case, the LWPOLYLINE is inside a Block entity and the program is not returning correct points.
Please check Lisp Program below:
(defun C:alb()
(setq ent1 (entsel "
Pick on one side of LWLINE ofa Block:" ))
(setq ent (nentselp (cadr ent1)))
[code]........
View 9 Replies
View Related
Sep 19, 2012
I am trying to insert a norht block oriented on two selected points with the following
(defun c:North ( / ss )
;Orientate North Symbol
(setq oldos (getvar "osmode"))
(setq blk (vlax-ename->vla-object (car (entsel "
[Code] .......
I am not sure how to (a) erase the selected north block, then (b) make the insert north block in its place bit work.
View 6 Replies
View Related