AutoCAD 2010 :: Lisp For Extract Number Value From Between Text String
Sep 5, 2012I have text with number string. ( eg: weight 50 kg, xyz weight 362 kg)i want to extract the number values of "50" & "362" from the text string.
View 9 RepliesI have text with number string. ( eg: weight 50 kg, xyz weight 362 kg)i want to extract the number values of "50" & "362" from the text string.
View 9 Repliesi failed to find one which would change string of a text to other for all types of objects. I mean it was usually either only multitext, or only text, dimensions or attributes.creating one which would change in abt 200 drawings:
-001
-002
-003
to:
-00001
-00002
-00003
in attributes, text, multittext, leaders, multileaders, dimensions..... at the same moment?
It is meant to be used in ScriptPro (by loading lisp in script).
If not possible, then can also open each file and run the lisp in each of them - still would save lot of time.
I have a custom iProperty with a text value of "Plate, Steel 140 mm". Is it possible to strip out the 140 (text) from the string and convert it to a number?
View 7 Replies View RelatedI have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg"). how would i go about doing that using LISP?
View 2 Replies View RelatedI'm looking for a function to return the actual text from an mtext object.if there's a carraige return I wish to replace it with a space.
View 4 Replies View RelatedIn order to avoid duplicate text string in different places in the same drawing, I would like to have such a tool to find duplicate text string.
For instance, I want to put numbering of some connection lines, I do not want to have different lines but have same number by mistype.
I would like to know how I can compare the value of a variable to a set string of text if the two prove to be equal perform task A if the two prove different perform task B?
View 7 Replies View RelatedI need a lisp routine that will add or subtract to modify a value in a text string. Its used for drainage fixture units on waste & vent plans. Example: We use basic dtext strings that look like this [color=red]4"(6)[/color]I would like to be able to add or subtract to the number that is [b][size=12pt]ONLY[/size][/b] in parenthesis and would like to be able to pick multiple text strings at one time so it would result in something like this: [color=green]4"(6)[/color] + 9 will become [color=blue]4"(15)[/color].
View 9 Replies View RelatedI have spent the last three days writing a lisp program that will copy a text string from one text file and paste it into another. I have tried using the write-string, getstring, prin1, princ and print functions with no success.
View 6 Replies View RelatedI was wondering if there is a way that AutoCad can edit one text string and the same change can affect another text string, instead of editing the same thing twice.
View 9 Replies View RelatedSomeday the light bulb is going off and I will understand mapcar and lambda. However.....I have a program that reads an excel file sheets. Sometimes the sheet only has 1 column, sometimes 2 or more.
I need to convert the saved values from the sheet to a list with the text spaced evenly. Unfortunately the text lengths vary. I would like a subroutine to pass the list to and return a list of strings with text aligned with padded spaces allowing for the longest text in each column. I am using the new list in a dialog box with fixed_width_font=true (so columns align).
Example 1-
(setq List1 (list "Col1-Line1" "Col1-Line2" "Col1-Line3-longer" "Col1-Line4"))
(AlignText List1)
returns
"Col1-Line1"
"Col1-Line2"
"Col1-Line3-longer"
"Col1-Line4"
so no padding needed
Example 2 -
(setq List2 (list (list "Col1-Line1" "Col1-Line2" "Col1-Line3-longer" "Col1-Line4") (list "Col2-Line1-longer" "Col2-Line2" "Col1-Line3" "Col2-Line4")))
(AlignText List1)
returns
"Col1-Line1 Col2-Line1-longer"
"Col1-Line2 Col2-Line2 "
"Col1-Line3-longer Col2-Line3 "
"Col1-Line4 Col2-Line4 "
Example 3 -
(setq List3 (list (list "Col1-Line1" "Col1-Line2-longer" "Col1-Line3" "Col1-Line4") (list "Col2-Line1-longer" "Col2-Line2" "Col1-Line3" "Col2-Line4") (list "Col3-Line1-longer" "Col3-Line2" "Col1-Line3" "Col3-Line4")))
returns
"Col1-Line1 Col2-Line1-longer Col3-Line1-longer"
"Col1-Line2-longer Col2-Line2 Col3-Line2 "
"Col1-Line3-longer Col2-Line3 Col1-Line3 "
"Col1-Line4 Col2-Line4 Col3-Line4 "
I am trying to add text to a set of text strings in a drawing.
The tricky part is that not all of the text strings are the same.
For example, change part numbers
123, 125, 456, 892
to
123-70, 125-70, 456-70, 892-70
Is there a way to do this for all of the strings at once?
I have spent the last three days writing a lisp program that will copy a text string from one text file and paste it into another. I have tried using the write-string, get string, prin1, princ and print functions with no success.
View 2 Replies View RelatedI have a routine that looks for an MText date stamp and replace the old date with a new date. The problem is some MText strings appear encrypted. Below is an example:
{\H1.121x;\C1; \LFY 2011-12\l \H0.6252x;04-30-11} This is what I should get when I extract the string (as shown in Property window)
(1 . "\pxi-2.1818,l4.3636,ql,t4.3636;{\fSymbol|b1|i0|c2") is what I get when I extract the group code.
I'm running AutoCAD 2012 on Windows 7.
I have a drawing which has hundreds of levels on and i'm trying to establish what the MEAN level is and the AVERAGE level. I thought the best way might be to extract the text to excel and perform it there but at the moment the only way i can do it is to copy and paste the text and its taking me forever. Is there a way to either a) extract text to excel or b) calculate a MEAN value based on texted selected?
View 2 Replies View RelatedSeeing this error
Error on Line 10 : 'SealString_1' is not declared. It may be inaccessible due to its protection level.
Dim SealString_1 As String Dim SealString_2 As String Dim SealString_3 As String Dim SealString_4 As String Dim SealString_5 As String Dim SealString_6 As String Dim SealString_7 As String For Each S As String In SealString_1.Split(",") If i = 0 Then name = S If i = 1 Then name = OD If i = 2 Then name = ID If i = 3 Then name = DE If i = 4 Then name = LI i = i + 1 Next S
I'm dimensioning an old drawing with the real (measured) dimensions and with the drawing dimensions in brackets (using ' 1500 (<>)' to give '1500 (1505)' for example.
What I'd like is to also be able to put on the difference between the length I type in and the length in brackets - as this would let me see any really glaring errors that can't be attributed to user-error on the laser measure.So I could type in '1500 (<>) (X)' where X is the formula, and get ' 1500 (1505) (5)' back?
How to be able to run a script that could highlight any dimensions where the number is brackets and the typed number have a a difference of, say, 50.Or failing that, any way to extract all the dimension text at the end into excel so I can see the differences myself?
I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg"). how would i go about doing that using LISP?
View 2 Replies View RelatedI've been looking for a solution to remove the unit string ie Lbs, g, kg from the value given from a 'Mass' value in a text string.
As you may all know, creating text and having a 'physical property - mass' value...the unit string is there...
Lots of people on here have the problem...no-one has got a solution.
Until now...
Basically...open the part you need to get the mass property of in your text string.
Follow the instructions on this webpage...this is the first part...
[URL]
Basically, this creates a Mass property value in the parameters table that you can call on as a text parameter.
It's similar to the custom iproperty model - mass but NOT the same.
Once you have done this, you can go to the drawing of the part and create a text string in the drawing and call it up as shown in this procedure. BUT it still has the unit string.
Here's the best bit that you want to know...
To get RID of the unit string...open up the part again from the drawing...click on the parameter icon...find the user parameter...in the Nominal value column, right click on the value and you get a pop-up that gives you 3 options...
Custom Property Format, Make Multi Value & Delete Parameter.
Click on Custom Property Format.
The pop-up window comes up...showing you the property type...in my case...the 4 left columns read Text, g (grams), Format & Precision...
On the right hand side I have a Preview of the text...then 3 check boxes...Units string, Leading Zero's, Trailing Zero's.
Units string is checked.
Uncheck it.
Close it...Save your part...go back to the drawing and hey presto!...the text now shows the weight you require as a straight value...no units!
ACAD LT 2006
I have various blocks with a letter assigned to them as a type. Problem is that some blocks are the same one but have a different letter as an attribute.
Is there a way to extract the number of blocks by a different attribute?
How to “synchronize” the ‘layout number” with “sheet number”?
As in most cases, the arrangements of “lay outs” reflects the way they are regularly printed, then how could we renumbering the sheets such that the first lay out takes number 1, the second lay out takes number 2,…and so forth.
For example, in the screenshot below, the
Software: AutoCAD 2014, AutoCAD C3D, AutoCAD M3D, Revit
Windows 7 (Ultimate 64 bits),
Firefox 20.0,
Kaspersky 2013.
I have a list that is "acl", I would like to convert it to a string "acl", everything that I have read uses alot of code. Does this really take that much code to do?
View 9 Replies View RelatedHere's one that I could use on that i can't figure out:
I have a list of a bunch of descriptions that looks like this:
("00.02.00" "CTD01 Mainframe PT1 (top)" "GD01")
What I am doing is grabbing the middle item and i need to break this up into 2 lines. So, my code below grabs the first 3 "words" in the second item in the list and puts them in a list, but I need to convert this back to a string.
(setq desc6a (list (car (read (strcat "(" (cadr input6) ")" )))(cadr (read (strcat "(" (cadr input6) ")" ))) (caddr (read (strcat "(" (cadr input6) ")" )))))
I tried a bunch of ways but can't get it
I am trying to make this: L:Engineering-208037SURVEYDRAWINGS turn into this: L:Engineering-208037DRAWINGS
I am using the dwgprefix and it returns the first string and i want to make it in the second string as a new variable or replace the old variable so i can use it in a save as routine i am working on.
The problem is sometimes them project number (0208037) will be longer or shorter so i can't use the substr command
acad_strlsort will sorts strings, but what if my list looks like
("1" "2" "3" "10" "11" "12" "20")
i am sure i have seen it done ina simple way using vl-sort or vl-sort-i
but am not able to find...
I've been working on a lisp to set up basic settings such as text styles, dim styles, discipline specific layers and things of that nature.
I have a prompt to ask for a discipline designator as a string. I want to have an If statement or a conditional to read that string and check for a "C" if it finds it I want to have it set up a dimstyle to decimal feet ect and if not do it as architectural units.
This is just a test lisp that I'd like to add to the main one listed above...
(defun c:test(/ disc dsnm dsna)
(setq disc (getstring "
Discipline (G,C,S,M,E,CP): ")) ;Prompt for Discipline
(setq ds (getint "
Dimscale Factor: ")) ;Prompt for Dimscale
[code].......
I would like to use a string as a variable if this is possible. I've got:
new-pl-lay (as a variable that holds layer name "UGL_PL_NEW")
first-cable (as a string that holds "new-pl-lay")
I'd like set the current layer to "UGL_PL_NEW" by using the first-cable string.
Something like:
(command "_.layer" "m" (read first-cable) "")
I have created a string:
strAttValue = ("3/16""=1'-0""")
or alternatively I've tried:
strAttValue = ("3/16" & Chr(34) & "=1'-0" & Chr(34))
that I would like to pass to a lisp with the format:
(defun lispTest ( strAttValue / )
but when I do it errors with "Too many variables." The passing method is as follows:
acDoc.SendStringToExecute("(lispTest" & Chr(34) & strAttValue & Chr(34) & " ) ", True, False, False)
If I get rid of the quotes in the original string it works fine, but the quotes are needed.
I'm working on a LISP function that adds a predetermined string to each layername in the dwg.
I came up with this:
(SETQ prefix "A-_82-_")
(TBLNEXT "LAYER" T)
(WHILE (SETQ la (TBLNEXT "LAYER"))
(SETQ old (ASSOC 2 la)
new (CONS 2 (STRCAT prefix (CDR old)))
[Code] .....
The line (princ "
la is: ")(princ la) (princ "
") is thrown in to enable me to see the result of the while function, and is to be removed from the final version.
Now, everything seems to work fine, as the princ shows on the acad textstcreen.
Yet, when I check the layer palette, all layernames remain unchanged.
My guess is that I should use some other function then ENTMOD or ENTUPD to change the layertable, but I'm at a bit of a loss as to which function is required.
I have a lot of attribute blocks in my drawing which i want to move them one by one
so , here is what i want to do :
I have numbers (or texts) in my work area and this numbers also exist in my attribute blocks .. i wanna move my attribute blocks with tag name value reference to my specify area if tag name values are matching with text or numbers in this area .. every block will check my selected tag string and will be move on matching text in my work area.
I have a list of (0 .4 .8 0 10). I want to convert every element of the list to string.
View 4 Replies View Related