AutoCAD Visual LISP / AutoLISP :: Prompt Text / Mtext Not Selected

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


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Suppress Mtext Command Current Text Style / Prompt

Nov 3, 2011

I'm running the following string in a routing that is looping so I get dozens of these prompts. How to supress these?  Or, do i have to use to entmake?

(begin loop...
(command ".-Mtext" CSW-Tpoint "W" 0.0 (vl-filename-base (vla-get-imagefile image)) "")
);end loop

Prints to the command line..

Current text style:  "Standard"  Text height:  0.0833  Annotative:  No
Current text style:  "Standard"  Text height:  0.0833  Annotative:  No
Current text style:  "Standard"  Text height:  0.0833  Annotative:  No
Current text style:  "Standard"  Text height:  0.0833  Annotative:  No

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Text String From Mtext?

Aug 20, 2013

I'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 Related

AutoCAD Visual LISP / AutoLISP :: Using TEXT Not MTEXT To Create Multiple Lines Of Text?

Oct 4, 2011

3rd party tool which didn't match our scaling needs the file is a fas so I have tried to reverse engineer the whole function using trial and error. The following code works perfect except we need multiple (x amount) lines of text I have at current the M txt function which mimics and is effective for today however we need all lines to be individual.

I’m playing round with a loop but how to achieve my need..He had a 3rd party tool which didn't match our scaling needs the file is a fas so I have tried to reverse engineer the whole function using trial and error.

The following code works perfect except we need multiple (x amount) lines of text I have at current the M txt function which mimics and is effective for today however we need all lines to be individual.
 
;Starting lisp program...(defun C:REDtext ();Creating Layers (if non existant)...(command "layer" "m" "TEKST-1.5mm" "lt" "continuous" "" "c" "1" "" "");Memorising previous layer...(setq MYOLDLAYER (getvar "clayer"));Setting requierd layer...(COMMAND "LAYER" "SET" "TEKST-1.5mm" "");Setting variable "MYHEIGHT" to "DIMSCALE" x 2...(setq myheight (* 2 (getvar "DIMSCALE" )));Requesting and storing usser defind point...(setq MYPOINT (getpoint "Start punt :")); Requesting and storing user defind text...(setq MYTEXT (getstring T "Nieuw tekst :"));Placing text...(command "text" MYPOINT MYHEIGHT "0" MYTEXT); Restoring previous layer...(setvar "clayer" MYOLDLAYER);Closing lisp program...)

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Access Text In MTEXT Entity

Dec 29, 2012

I am wanting to use autolisp to access the text in a MTEXT entity.  assoc(1) gives me the first bit of text, but not the rest.Is there a way to use assoc to access each of a number of matches or do I need to write my own routine to find all the 1's?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Accept Text Height In Mtext Command

May 31, 2013

I am working on a simple function to add/remove a non-printing stamp our drawings to specify a preliminary drawing. The issue is that I cannot seem to get AutoCAD to accept the text height in the Mtext command. Below is the code; try it and see.

(DEFUN NOT4CONSTRUCTION(/ CTR HGT PT1 PT2) (IF (EQ (GETVAR "CLAYER") "NOT4CONSTRUCTION") (SETVAR "CLAYER" "0")) (IF (EQ (GETVAR "CTAB") "MODEL") (SETQ HGT "8'-4"") (SETQ HGT "1"")) (IF (= (ASSOC 0 (TBLSEARCH "layer" "NOT4CONSTRUCTION")) nil) (PROGN (VL-CMDF "-LAYER" "M" "NOT4CONSTRUCTION" "C" "30" "" "TR" 90 "" "P" "N" "" "") (SETQ PT1(LIST (- (CAR (GETVAR "viewctr")) (/ (* (GETVAR "viewsize") (/ (CAR (GETVAR.
[code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Explode Mtext - Get X Y Coordinates Of Last Line Of Text

Mar 19, 2012

Would like to be able to select mtext explode it get x y coords of last line of text then turn it back to mtext and then launch mtext at a @0,-0.5  justification TL width 5 and display the ribbon.

All seems to work except the (command ...)

Below is my attempt.

(prompt "Select Note")
(setq ss (ssget))
(command "explode" ss)
(setq ss (ssget "l")) ;get last line of text

(setq ent (entget (ssname ss 0))
ent1 (cdr (assoc 10 ent))) ;get x y coords
(command "undo" "1") ;set exploded mtext back to mtext
(setvar "lastpoint" ent1)

(command "mtext" "@0,-0.4" "j" "TL" "w" "5")

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find And Replace Pre-defined Text / MText Value

Feb 10, 2011

Is there a lisp or script program that will find and replace pre-defined text/mtext value of eg " issued for tender " for "issued for construction" without having to select anything.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Layer From Highlighting Words In Text Or Mtext?

Sep 23, 2011

I want to create a layer from selecting only some words from an mtext or text entitty.

Is it possible to highlight and select only part of the text from an mtext using a lisp routine ? similar to how Adobe Reader can select text.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Combine Multiple Mtext Into 1 Mtext

Apr 16, 2009

Tool to combine multiple pieces of Mtext into a single Mtext with paragraphs?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selected Text(s) To CSV Files

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

AutoCAD Visual LISP / AutoLISP :: Find All Text In Selected Items And Swap Text

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

AutoCAD Visual LISP / AutoLISP :: Mtext String In Group 1 Does Not Match Text Shown Or In Property Window

May 17, 2012

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

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Show Difference In Selected Text?

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

AutoCAD Visual LISP / AutoLISP :: Adding A Text To Selected Texts?

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

AutoCAD Visual LISP / AutoLISP :: Getting Routine That Will Sum Selected Text Values?

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

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 View Related

AutoCAD Visual LISP / AutoLISP :: While Loop With Prompt

Nov 19, 2013

I am trying to put together a loop to enter a number greater than the previous number entered. Below is my mockup and I just cannot get it.

(defun c:22 () (while (setq d (getreal "
Specify diameter: ")) (setq $d d) (while (if (<= d $d) (progn (prompt "
Specify greater diameter.") (setq d (getreal "
Specify diameter: ")) ) ) ) (setq p1 (getpoint "
Specify point: ")) (command "CIRCLE" p1 d) ))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selected Text To Tagged Attribute Including Prefix / Suffix

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

AutoCAD Visual LISP / AutoLISP :: Larger Routine To Create And Rotate Text Based On Object Selected

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

AutoCAD Visual LISP / AutoLISP :: Creating Menus In Command Prompt?

Nov 22, 2011

I am able in lisp to create a command prompt selection menu, easy (see code below).However what I want is for the lisp to be ready to undertake an action UNLESS I select an option.

An example is the offset command wich has a function ready to roll (namely the specify offset distance) "OR" I can interrupt the "specify offset distance" and enter one of the sub options (in the case of offset Through/ Erase/Layer).

My code attempts to offset also, UNLESS the user wishes to specify a distance.
 
(DEFUN C:loadoffset ();CREATING MENU FOR SUB COMMANDS [GETIT] [GOTIT]...(setq choose (getstring "
Select an option... [1=GET DIST] [2=GOTDIST]: "))(if (or (equal choose "1"))(GETIT))(if (or (equal choose "2"))(GOTIT));TERMINATING SELECTION MENU...)(defun getit ( gotit )(setq MYDIST (getdist "
SELECT A DISTANCE: "))(gotit))(defun gotit ()(command "_offset" MYDIST pause pause"exit"))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Change Command Prompt Directory

Aug 17, 2011

When you use shell command and type cmd, command prompt appears and the default location is My Documents. How can i change it to another directory by using only lisp?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Loop File Names In Command Prompt?

Dec 6, 2012

I have a parent directory with x-amount of folders contained inside. I say X-amount because I would like to keep adding or deleting folders as time progresses. I want the folders contained within this parent directory do be read into a lisp variable and then be printed to the command prompt till every folder is displayed by name, then the loop may stop.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block With Pick Point On Line Prompt?

May 8, 2013

I have a lisp routine that I would like to add to. Right now when running the macro the user is not prompted to "Pick Point On Line" in this example

(command "insert" blk "s" var1 pause pause))

I have added the line

(setq pt1 (entsel "Pick Point On Line "))
(command "insert" blk pt1 "s" var1 pause pause))

but the command doesn't seem to like my PT1 value

BLK and VAR1 are set in another lisp routine.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Mtext Editing

Nov 12, 2013

I have mtext in several drawings that contains an error that'd I'd like to fix using Lisp.  An example of what this text should look like is:

NOTE:

SEE DRAWING XXXX FOR DRIVE DETAILS

The fist problem is that all of the text after the note has a width factor of 0.1 and is all squished together.  The second problem is that the text height of the title (the "NOTE:" part) is supposed to be larger than the actual note (the "SEE DRAWING XXXX FOR DRIVE DETAILS" PART).  Is there a way to fix this using lisp?  I had a lisp in progress (not done) which is:

(IF
  (SETQ SSET (SSGET "X" '((0 . "MTEXT"))))
  (PROGN
    (SETQ COUNT -1)
    (WHILE (< (SETQ COUNT (1+ COUNT)) (SSLENGTH SS))
      (SETQ ENTDATA (ENTGET (SSNAME SSET COUNT)))
      (SETQ ENTTEXT (CDR (ASSOC 1 ENTDATA)))
      (ENTMOD (SUBST (CONS 1 (STRCAT "{\W1;" ENTTEXT "}")) (ASSOC 1 ENTDATA) ENTDATA))

The last line has no effect on the width factor of the note.

This is the entdata for this particular piece of mtext (they aren't all the same):

((-1 . <Entity name: 7ffff79ce50>) (0 . "MTEXT") (330 . <Entity name:
7ffffb069f0>) (5 . "392FD") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"5") (100 . "AcDbMText") (10 676.276 751.03 0.0) (40 . 3.008) (41 . 0.0) (46 .

[Code]....

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Mtext Background

Aug 31, 2011

I have a routine, developed for me through this forum, that selects text or mtext, converts to mtext if not already, and puts a background mask with 1.1 border. I was using it fine in Map 3D 2007, but have recently switched to Civil 3D 2012 where it does not work. I get this error message:

; error: no function definition: VLAX-ENAME->VLA-OBJECT

Why does this not work in 2012? How to get it to work?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: MText - Set Limits Box To Minimum?

Jan 11, 2006

I would like to write a routine to resize the MText limits box to the minimum size required to cover the text, for background masking purposes. From the DXF codes, I see that I can simply set code 41 to match code 42 in order to set the width. However, I cannot seem to figure out how the vertical dimension is defined. (entget) shows no change in the DXF codes after I resize the mtext box.

I do know how to figure out the height that I need, using (acet-geom-textbox), but I can't seem to figure out how to apply this height the MText entity.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Converting MText To Multileader

Nov 19, 2013

I got this nice little lisp from [URL] .....
 
(defun c:mt2ml ( / oobj nobj nstrg) (vl-load-com) (setq oobj (vlax-ename->vla-object (car (nentsel "
Select source text: ")))) (if (= (vlax-get-property oobj 'ObjectName) "AcDbMText") (setq nstrg (vlax-get-property oobj 'TextString)) (exit) ) (command "_MLEADER") (while (= 1 (logand (getvar "CMDACTIVE") 1)) (command PAUSE)) (setq nobj (vlax-ename->vla-object (entlast))) (if (= (vlax-get-property nobj 'ObjectName) "AcDbMLeader") (vlax-put-property nobj 'TextString nstrg) (exit) ) (entdel (vlax-vla-object->ename oobj)) (princ))

It converts MText to a Multileader.

My goals would be as follows:
 
The multileader should end up on the same layer as the Mtext.  (Currently it uses the current layer.)The multileader should hold the same rotation as the Mtext. (Currently it goes to zero.)The multileader should be created in the same location as the Mtext, without the user having to click.  (Currently the multileader is created wherever the user clicks.)The multileader should be created without a leader.  We can add one afterwards if needed, but for many we don't need a leader.  (We're just using the object as mtext with a box around it.)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Calling Mleaders With Mtext

Oct 17, 2007

I'm finding Mleaders with Mtext don't seem to play well with command calls. All works fine until one tries to enter the mleader text. Before testing this, be sure your mleader style is set to use mtext. I recommend starting the leader with the arrow first.

Compare this mleader's text entry behavior in this basic lisp command call:(command "_.acad_dim.mleader") with the following routine that relies on an open ended command prompt (useful if you want to add more commands after calling the mleader command):

(defun c:mlx (/ cc_echo)
(prompt "
Example showing mleader mtext misbehaving")
(setq cc_echo (getvar "cmdecho"))
(setvar "cmdecho" 1)
(command "_.acad_dim.mleader")
[code]...

With qleaders, the leader and text are separate entities.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Edit MTEXT Attribute Value

Dec 13, 2013

I'm having issues with updating an MTEXT attributes value using lisp.

If I insert my block (this is a titleblock) and run my lisp routine the MTEXT attribute updates fine.  Once I edit the MTEXT attribute with the MTEXT editor, and then run my lisp routine again, the MTEXT attribute will not update anymore.  All the single line (DTEXT) attributes update fine.  The lisp routine I created has worked for years...this is the first time I've tried it with an MTEXT attribute.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Mtext Rotate To Line

Oct 15, 2013

Lisp routine that will rotate Mtext to the same angle as the angle of a selected line and the allow you to place the mtext object where you wish.

I know there is an lisp out there called RTL that will allow you to do this with regular or Dtext, but I will not work with Mtext.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved