Jump to content

Search the Community

Showing results for tags 'write'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 3 results

  1. Hi, I tried to write an autolisp code and I got to a certain point, but it is not working as I wanted. I would like your suggestions and your support in revising the code. What I want to do is select a block. To find out which character (n) from the right is the "-" sign in the layer name of the line touching the block I selected. Then subtract 1 from this character(n) number and add n-1 from the right. Combining the part up to the character and the prefix text and writing to the block geometric point. The way this code works now is to combine the front text and the text to the right of the "-" sign of the last layer added to the layer list and write it to the center of the block. This wasn't something I wanted. (setq *textHeight* 8) (setq *layerName* "01 Equipment list 2") (setq *textColor* 1) ; (defun c:bs_ayar () (setq *textHeight* (getreal "\nEnter new text height: ")) (setq *layerName* (getstring "\nEnter new layer name: ")) (setq *textColor* (getint "\nEnter new color index (1 for Magenta): ")) (princ (strcat "\nText height is now " (rtos *textHeight*) ", layer name is " *layerName* ", color is " (itoa *textColor*) " was set to. ")) (princ) ) (defun c:bs4 () (setq prefix (getstring T "\nEnter prefix letter: ")) (setq blk (car (entsel "\nSelect Block: "))) (setq blkEnt (entget blk)) (setq insPt (cdr (assoc 10 blkEnt))) (setq ss (ssget "_X" (list (cons 0 "LINE,POLYLINE")))) (if (and ss (> (sslength ss) 0)) (progn (setq line (ssname ss 0)) (setq lineEnt (entget line)) (setq lineLayer (cdr (assoc 8 lineEnt))) (setq dashPos (vl-string-search "-" lineLayer)) (if dashPos (setq rightPart (substr lineLayer (+ dashPos 2))) (setq rightPart lineLayer) ) (command "._-LAYER" "_M" *layerName* "" "_C" *textColor* "" "") (command "._TEXT" insPt *textHeight* "" (strcat prefix rightPart)) (command "._-LAYER" "_S" *layerName* "") ) (princ "\nNo line or polyline was found touching the selected block.") ) (princ) )
  2. I am stuck on the syntax to write a block without user input. On executing the lisp, I want it to get a selection set from a variable and then write it to a new block without asking the user for input. The basepoint can be "0,0,0" and the file path is a pre-set path. The general command I'm trying to use goes like this (I know it's wrong, but I don't know where to go from here) (command "-wblock" "C:\\Users\\DefaultUser\\Desktop\\ScriptTest\\Blocktest1.dxf" "0,0,0") I've searched LISP routines all over the place but can't find one that does this. I'm mostly looking for examples that contain a similar line of code.
  3. I have some drawings which contain hundreds of numbers (example: 1-218b), each of which is on geometry which will be written as a block into its own folder. I am trying to write a Lisp that will create all of the folders based on the selected text. I have found a few posts about writing a directory, but it's all super confusing to me. General routine process: 1. Get selected text objects 2. Prompt for directory to create new folders in 3. Create a folder for each selected text object, named based on the text It's ok to assume that the text is already selected when the Lisp starts. If no text is selected, I'd just send an error message to the console and end the routine. It's preferable that the directory prompt is GUI based so that I can navigate to the directory, but I am absolutely clueless here. If needed, I can just copy and paste the directory path into the console. The routine doesn't have to work with MText. The files contain only single line text. If I can get any code working, I'll post it, but I think it's going to take a good long while.
×
×
  • Create New...