AutoCAD Visual LISP / AutoLISP :: How To Write Unicode Characters To Text File

Jun 27, 2013

I can't write unicode characters to a text file.

as you know, you can write chars on text screen easily: (write-line (strcat "\U+" "2122"))

but if you want to write chars to a text file, this command does not work: (write-line (strcat "\U+" "2122") TxtFileVar)

Here is a part of my code to test:
(defun C:HexGen ( / d f S w x y z h c)(setq d '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F") f (open "c:\0000-FFFF.txt" "w"))(foreach w d (foreach x d (foreach y d (progn (setq S "") (foreach z d (progn (setq h (strcat w x y z)) (setq c (strcat "\U+" h));;;<===character (setq S (strcat S " " (strcat h " = " c ))) ) ) (write-line S f) ) ) )) (close f)(startapp "notepad" "c:\0000-FFFF.txt"))

View 9 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Replacing Characters In A Text File

Sep 13, 2012

Replacing characters in a text file.

I solved the following Lisp routine chore. I have this csv file of coordinates (and many more) that comes from a total station:1,100,100,10,50

2,100,200,12,50
3,200,200,12,50
4,200,100,10,51

and should replace the code after the last comma like this:1,100,100,10,.50
2,100,200,12,.50
3,200,200,12,.50
4,200,100,10,..50

To be able to generate the topographic map. And I have this code but does not work properly:

(defun c:cod (/ filename fileopenr readline)
(if (setq filename (getfiled "!!! SELECT *.csv FILE COORDINATE:... ¡¡¡" "c:/" "csv" 0 ))
(progn (setq fileopenr (open filename "w"))
(while (setq readline (read-line fileopenr))
[[code].......

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write Several Lines Of Text To TXT File?

Apr 13, 2012

I know how to write a single line of text to a txt file with LISP, but how do i write two or more lines of text to a txt file ussing lisp?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write Content Of Variables To Text File?

Feb 17, 2013

I want to write content of variables to a text file but I should have conversion function for variables.

for example

(setq a 123); a is an integer type, contetnt of a is 123

so I should use (itoa a) to get "123" as a string and then I can write it to text file.

but what about another type of variables?
 
(defun ToString ( a / result)(setq result "")(cond((= (type a) 'ENAME) (progn (setq result "Entity names")))((= (type a) 'EXRXSUBR) (progn (setq result "External ObjectARX applications")))((= (type a) 'FILE) (progn (setq result "File descriptors")))((= (type a) 'INT) (progn (setq result (itoa

[Code].....

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Open File To Write On External Drive - Bad Argument Type

Jun 5, 2012

I'm trying to open a file to write to on my external drive, I get this message "bad argument type: stringp nil".

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write A Lisp Routine That Invoke The Mleader Command

Oct 11, 2012

I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.

attached is what I have written so far:-

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Chinese Characters In DCL Files?

Jan 19, 2012

I have some legacy custom .DCL files that we want to convert the user interfaces (text boxes, labels, etc) to Chinese characters.  Is that even possible in .DCL?

I have gotten our NET and VBA apps converted but not having much luck with the DCL files.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: ActiveX And Chinese Characters

Mar 26, 2013

we use AutoCAD 2013 english version also in China.

Have a look to t below process

(setq app (vlax-get-acad-object))
(setq actdoc (vla-get-activedocument app))
(setq actlay (vla-get-activelayout actdoc))      
(setq laynam (vlax-get-property actlay 'name))

 On a Chinese computer with Windows XP, the layout name via ActiveX is displayed correctly "A3 -布局-02" on the variable laynam.

But under Windows 7 64 Bit I get this "A3 -??-02". So all ActiveX objects with AutoLisp commands do not transfer the Chinese Unicode characters, also on a system in china.

But the pure lisp command (layoutlist) for example returns always the correct characters ("A3 -布局-02")

Do I need any Chinese dll’s for ActiveX dependent language? On my test PC I installed the file autocad_2013_traditional_chinese_language_pack_win_64bit in the hope I get shared files for ActiveX but this did not bring success.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Finding And Replacing Very Special Characters

May 15, 2013

Is there a way to find and/or replace "very" special characters like [carriage return], [backspace] or even [tab mark], considering that the first thing that comes to mind when saying special characters is the standard and extended ASCII only.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Using Special Characters In Custom Command

May 4, 2012

I'm trying to write a simple Custom Command that sets any layer that matches "$-*" to a specific color. But as soon as AutoCAD sees the $, it thinks I'm trying to do a DIESEL expression. Supposedly, the quote marks specify that the enclosed characters should be treated as plain text, but that doesn't happen.Here's what I've got:

^C^C-LAYER;C;252;"$-*";;

And this is what I get:

Command: -LAYERCurrent layer: "$-HATCH-00-002-PW-BOAT"Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: CNew color [Truecolor/COlorbook] : 252Enter name list of layer(s) for color 252 <$-HATCH-00-002-PW-BOAT>: "No matching layer names found.Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]:
It stops, hanging at the incompleted -LAYER command prompt. 

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Writing Elevation Text In A Cad File From Text File

Jun 27, 2012

Write the elevation text in a cad file from attached text file.

In this text file Easting Northing and Elevations are given. We have hundreds of that text files.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Last Characters Of Block Name In Selected Object?

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

AutoCAD Visual LISP / AutoLISP :: Create A Table With All Characters Inside A Font

Jan 4, 2013

I want to create a table with all characters inside a font.I used "%%" to change a number to it's character.but "%%" limited to 999 and for numbers bigger than 999 it doesn't work.

also, CHR command limited to 255 and for numbers bigger than 255 it change to (number-255). so I used "%%" to create this table:[Please change default font in your AutoCAD to ARIAL]

(Defun c:charmap ()
(setvar "cmdecho" 0)
(setq cnt 1.0)
(setq r_cnt 0.0)
(setq ts 32)
(setq x 0.0)
(setq y 0.0)
[code]...

I want to know:

1- what can I do for numbers more than 999?

2- How can I know the number of characters inside a font?

3-how can improve my LISP program to have complete characters inside the fonts?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Read And Write Of Notepad Numeric Data?

Mar 21, 2012

I have some numeric data like 1, 2, 3, 4, 5 in mtext format in autocad drawing file and some numeric data like 1,2, 3 in notepad.

How can i get the remaining numeric data of autocad dwg into another notepad using autolisp or visual lisp

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Assign Variable Based On The Number Of Characters To Be Removed

Apr 1, 2013

(defun layun (target_obj / original_layer original_layer_info target_obj_atts new_layer )(setqoriginal_layer (cdr (assoc 8 (entget target_obj)))original_layer_info (tblsearch "layer" original_layer)target_obj_atts (entget target_obj));setq(if (or(wcmatch original_layer "*-P123"); REMOVES 4 CHARACTERS(wcmatch original_layer "*-P123456"); REMOVES 7 CHARACTERS(wcmatch original_layer "*-P123456789"); REMOVES 10 CHARACTERS );or(progn(setq new_layer (substr original_layer 1 (- (strlen original_layer) ??))) ; NEED TO ASSIGN VARIABLE TO MATCH THE NUMBER OF CHARACTERS TO REMOVE(if (not (tblsearch "layer" new_layer))(progn(entmake ;;;begin to make new layer(list'(0 . "LAYER")'(100 . "AcDbSymbolTableRecord")'(100 . "AcDbLayerTableRecord")(cons 2 new_layer) ;;; layer name(assoc 6 original_layer_info) ;;;re-use original linetype'(70 . 0) ;;;flags - use default flags(assoc 62 original_layer_info) ;;;re-use original color);list);entmake);progn);if(entmod (subst (cons 8 new_layer) (assoc 8 target_obj_atts) target_obj_atts)));progn);if);defun

assign a character where ? is shown so that it matches with the number of characters to remove based on the 3 lines above (see wcmatch lines).  At present, whatever number I replace that ?? with, it removes that number of characters from the layer that I selected (if it meets that WCMATCH criteria).  Another option which may be more difficult is to be able to have the routine look at the object layer and if it contains -N- or -D- or -NEW- or -DEMO- then to remove all the characters that follow these layer modifiers.  This way I can cleanly add another project modifier behind these modifers. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getstring / Getint Digits / Characters Entry Limit?

Aug 26, 2013

I have been searching all over and have not found a method for limiting the number of digits/characters a user can enter for a getstring or getint prompt.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write Event Handler For Command Like Insert New Block?

Jul 19, 2012

Is it possible to write an event handler for an autocad event/ command like insert new block? I want the event to trigger the execution of an update routine . something like this post

[URL]

how do I access the autocad object in autolisp?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write Routine That Will Make Layer Called Hatch

Aug 1, 2012

I am trying to write a lisp routine that will make a layer called hatch, set it as current and then run the hatch command.

BUT the hatch command is not bring up the hatch dialogue box, it just puts things on the command line.

The layer is being made & set current.

The lisp is as follows:

(defun c:hh (/ ec)
(setq ec (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "-layer" "m" "hatch" "c" "8" "" "l" "continuous" "" "s" "hatch" "")
(command "hatch")
(setvar "cmdecho" ec)
)

On another matter, I have just found the bevel lisp routine by Terry Miller which works great BUT only for imperial measurements. How to make Terry's metric, that will work for metric measurements.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write A Macro In CUI That Opens A Drawing In Read-Only Mode?

Sep 18, 2012

Is it possible to write a Macro in the CUI that opens a drawing in Read-Only mode? Limitation : AutoCAD LT.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Import Layers From A Text File?

Mar 12, 2012

Is there a way to import layers from a text file?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reading A Line In Text File

Sep 27, 2011

I have the following code which isnt quite working, it reads a text file which has a list of Names of images and their bottom left coordinates i.e. name x y etc. I want it to check for a name equal to that input then in this case alert the user it is found, eventually I want it to load the tile but for the moment where am I going wrong, also the lisp wont close the file and I dont know why.

(defun c:imi ()
  (setq IM (getstring "
Input name of 2010 tile"))
 (while (not (= ""  IM))
  (setq TILE (strcat "BM" IM))
  [Code] ......

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Copy Text String From One File To Another

May 2, 2012

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, getstring, prin1, princ and print functions with no success. 

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Print Specific Variable To Text File?

Apr 5, 2013

I'm looking for a way to find out what all plot styles are set in drawings in a sheet set.

We are transitioning from color based pen settings to style based and would like to be able to export a log that shows the variable PSTYLEMODE for each drawing in a sheet set. I plan on using ScriptPro to run it on the full sheet set.

Civil 3D 2013
Windows 7 64-bit
Xeon W3550 3.07 GHz
Nvidia Quadro 4000
12.0 GB RAM

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Exporting Point Locations To Text File

Jun 8, 2012

Im trying to come up with a lisp that will export x and y coords to a txt or cvs file. However, I need the lisp to export in this format

Units       Inch
WPT      1     0     0     ( X=0 Y=0)
WPT      2     1     1     (X=1  Y=1)
WPT      3     2     2 

I need to be able to set my zero with move origin and the export the points.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Export TIME Command Results To Text File

Oct 22, 2011

Run TIME command and then take the resulting text and save it to a file.

Ideally, the text file should be named based on the drawing name. I know there's ways to write text to a file but I haven't had any luck taking the output of a command and exporting it.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Append To Text File / Record Date Variable

Feb 22, 2012

how to append I’m assuming its not write-line but append line. And also I’m having trouble recording the date variable… I keep getting error bad argument type stringp nil

; Appends usage count by DATE long variable...(setq g(open "C:/ICT/AutoCAD_Architecture_suite_2012/CUSTOM/WOOD Clones/PEN/USSAGELOG.PEN" "w"))(setq MYDATE DATE)(write-line MYDATE g); AS ABSOLUTE LAST WE NEED TO CLOSE THE TEXTFILE...(close g)

I have the following code snippet I’m trying to append the file named USAGELOG.TXT to record the date of executions

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Text File With A List Of Image Tile Names

Jun 12, 2013

I have a text file with a list of image tile names with their bottom left hand easting and northing see attached. I have a lisp that asks for the name of the image then should  insert the image at its coordinate with a predefined scale and rotation but it isn't working so I would like an alternative method to test.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: List Command Dumping To Text File Locally

Oct 31, 2013

Need a lisp that could dump the values of a list command in a text file placed in a folder C:user121list.txt.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Read Excel File To Insert Text Values At Coordinates

Mar 6, 2013

I got a new work and get it done in the next 2 days, but first I need to do this... from a text file (or excel file, I got both) I got 3 columns, 1 one for node number, and 2 other for X and Y coordinates for each node.

So from that file I need to insert into autocad the node numbers as text (using the current style and height) at the point specified by the other two columns, that are the X,Y coordinates which will be the insertion point of text..

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Unable To Read Plot Settings From Variable In Text File

Sep 2, 2012

I’m trying to create a plot command that reads settings in from a variable stored in a text file but its becoming muddled up somewhere.

(defun c:MYPLOT ();Setting nessesary variables...(setq fname "C:/ICT/AutoCAD_Architecture_Suite_2012/CUSTOM/TREADSTONE/PEN/MYOUTPUTDEVICE.PEN")(if(setq f(open fname "r"))(while (setq MYOUTPUTDEVICE (read-line f))(close)))(setq fname "C:/ICT/AutoCAD_Architecture_Suite_2012/CUSTOM/TREADSTONE/PEN/MYPAPERSIZE.PEN")
[code].......

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Existing Text To Keyboard Entry Text

Jun 21, 2012

I have two attributes "REVN" and "REVD" in a block "ATT" that I would like to change (globally preferably) to the following.

(1) Existing text to keyboard entry text.

(2) Colour from existing to 10

I am a bit lost in the (command "-attdef" .......)

(defun c:atc ()
(setq rev (getstring "Please enter review"))
 (setq dat (getstring "please enter date"))
 (command "-attdef" .."ATT".."REVN"....."c" "10")..)
 (command "-attdef" .."ATT".."REVD"....."c" "10")..)

View 4 Replies View Related







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