Jump to content

Search the Community

Showing results for tags 'user input'.

  • 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 4 results

  1. Hi guys, I'm new to this forum and new to programming with lisp - please be kind.... The code I am writing will draw a 3dPolyline from a specific point to another point (usually with a lower z coordinate), the polyline will then be converted to a spline, a circle will be drawn at the start of the 3dPolyline and extruded along the spline to form a "curved tube". The intention is to use this as a flexible duct from a "spigot" on an A/C duct to a ceiling diffuser. The 3dPoly has to be perpendicular to the start point and end point for obvious reasons - see intentional misalignment picture. Below a portion of the unfinished code to select the start point, select the endpoint, then it must start drawing the 3dpoly from the start point, get a variable number of user input points (in order to define the initial direction and plane) and general path of the flexible duct. The end point of the 3dpoly is already defined with the initial selection of the "Endpoint on Diffuser" although the 2nd last point has to be mathematically determined considering the plane must be perpendicular to the end point. So - after selecting say 3 or 4 user defined points along the path, I want to be able to press enter, and the code must then calculate the 2nd last point and continue drawing the 3dpoly from the last picked point, to the calculated 2nd last point and then to the endpoint. Generally one has to be mindful that the curve of the tube cannot have a "sharp bend" - smooth curves are ideal for the airflow. The diameter of the tube will also change depending on the specific size requirements. Attached a small drawing and picture to show the intent. The crux of my problem: I cannot figure out how to start the 3dpoly command, make it pick the start of the line, then hand over to the user to continue picking 4 or 5 points, press enter, and then continue drawing the 3dpoly with calculated numbers? Would really appreciate some guidance. Maybe use of cmdactive? I really do not know enough to figure this one out. (defun C:Flex250 () (command "_.layer" "_thaw" "HVAC Flex" "_make" "HVAC Flex" "") (setq Prev_OM (getvar "OSMODE")) (setvar "OSMODE" 8) (setq StartPoint (getpoint "\nEnter Start Point on Duct Spigot : ")) (setq EndPoint (getpoint "\nEnter End Point on Diffuser : ")) (setq Z0 (caddr EndPoint)) (setq Z1 (+ (caddr EndPoint) 50)) (setq Z2 (+ (caddr EndPoint) 150)) (setq pt0 EndPoint) (setq pt1 (list (car EndPoint) (cadr EndPoint) Z1)) (setq pt2 (list (car EndPoint) (cadr EndPoint) Z2)) (SetVar "Elevation" (princ (caddr StartPoint))) (command ".3DPoly" (princ Startpoint) (getpoint "\nNext point : ") pt2 pt1 pt0) ) Then a last question - is there a way to ensure the spline's start and finish points are 100% perpendicular to the planes they connect to? Thank you in advance for your input. Test.dwg
  2. Lee Chu Chu

    ESC User Input

    Is there anyway to check to see if the user has inputted into the command line and using a lisp, to tell that as soon as the user has pressed esc to not only cancel the command but to also set quantities?
  3. I needed to print 200+ drawings located in multiple locations, but only a section of each drawing that was not previously defined by a view or common coordinates... A batch printing process that could pause at each drawing to accept user input was what i was after. I stumbled upon a bundle of code that works! As a novice coder, I am hoping someone out there will tell me there is a much easier way! In order for this to work, I had to break in to a script file for user input. Since this cant be done, I created 2 seperate scripts within 2 LISPS that would loop infinitely.. I had to creat a txt file containing every drawing to be opened. This was done in excell fairly easily. The purpose of this list is to "read-line" and write to a script file. The script file would then contain one line. "OPEN" "file" "custom command" hopefully it makes sense as I post the code. The master list had to be modified everytime so that the first line is always "next" so I used VBA to delete the first line. This was all done with SDI=1 so i didnt have to worry about coding in a close.. Ok, here goes nothin... SET SDI=1 Main start program. The first drawing must be open at this time, and the master list will contain drawings 2 on. ;BATCH PRINT USER DEFINED VIEW ;JPLANERA 7/3/12 ;This routine will allow the user to define the view and will print the stored view ;Then the script callout starts the process that alters the "open" file script. ;Open the first drawing in the master list and initiate the DVP command to start. ;The master list will contain ALL but the current open drawing. (DEFUN C:DVP () (command "-view" "W" "1" pause pause) (while (= 1 (getvar "cmdactive") ) (command pause) ) (command "-plot" "y" "model" "RICOH C5000 ENG" "Letter (8.5\" X 11\")" "i" "P" "n" "V" "1" "f" "c" "y" "monochrome.ctb" "y" "a" "n" "y" "y") (command "script" "U:\\batchpress\\mos.scr") ) Contents of mos.scr -VIEW RESTORE 1 QSAVE MOS MOS.LSP this is the routine that reads from the master list, writes to a script file and erases the first line of the master list... ;OPEN DRAWING SCRIPT MODIFY ;JPLANERA 7/3/12 ;This routine will read the first line of the "master" list of drawings, then write it to a script file. ;This script file will contain only 1 line of code so autocad does not get "confused" ;A VBA routine is then used to delete the first line of the master list so that when ;this routine is run again, the first line to be read is the "next" drawing in the list. (defun c:MOS (/ MPTL L1 OF) (setq MPTL (open "U:\\batchpress\\masterpresstoollist.txt" "r") ) (setq L1 (read-line MPTL) ) (close MPTL) (setq OF (open "U:\\batchpress\\openfile.scr" "w") ) (write-line L1 OF) (close OF) (startapp "wscript" "\"U:\\batchpress\\deleteline.vbs\"") (princ) (command "script" "U:\\batchpress\\openfile.scr") ) contents of master list txt file (shortened of course). Done in excell. "DVP" at the end starts the loop back to the first LISP routine. OPEN M:\ENGR\Drawings\TOOLING\T18516\T18516.dwg DVP OPEN M:\ENGR\Drawings\TOOLING\T18519\T18519.dwg DVP OPEN M:\ENGR\Drawings\TOOLING\T18530\T18530.dwg DVP contents of script file to open drawings and call back first command LISP. I tried to do this all in the master list but kept getting runtime errors. I suspect because the list was being used while I was trying to edit it... solution was two files. OPEN M:\ENGR\Drawings\TOOLING\T18515\T18515.dwg DVP DeleteLine Function by TomRiddle 2008 DeleteLine "U:\BATCHPRESS\masterpresstoollist.txt", "", 1, 0 Function DeleteLine(strFile, strKey, LineNumber, CheckCase) 'DeleteLine Function by TomRiddle 2008 'Remove line(s) containing text (strKey) from text file (strFile) 'or 'Remove line number from text file (strFile) 'or 'Remove line number if containing text (strKey) from text file (strFile) 'Use strFile = "c:\file.txt" (Full path to text file) 'Use strKey = "John Doe" (Lines containing this text string to be deleted) 'Use strKey = "" (To not use keyword search) 'Use LineNumber = "1" (Enter specific line number to delete) 'Use LineNumber = "0" (To ignore line numbers) 'Use CheckCase = "1" (For case sensitive search ) 'Use CheckCase = "0" (To ignore upper/lower case characters) Const ForReading=1:Const ForWriting=2 Dim objFSO,objFile,Count,strLine,strLineCase,strNewFile Set objFSO=CreateObject("Scripting.FileSystemObject") Set objFile=objFSO.OpenTextFile(strFile,ForReading) Do Until objFile.AtEndOfStream strLine=objFile.Readline If CheckCase=0 then strLineCase=ucase(strLine):strKey=ucase(strKey) If LineNumber=objFile.Line-1 or LineNumber=0 then If instr(strLine,strKey) or instr(strLineCase,strkey) or strKey="" then strNewFile=strNewFile Else strNewFile=strNewFile&strLine&vbcrlf End If Else strNewFile=strNewFile&strLine&vbcrlf End If Loop objFile.Close Set objFSO=CreateObject("Scripting.FileSystemObject") Set objFile=objFSO.OpenTextFile(strFile,ForWriting) objFile.Write strNewFile objFile.Close End Function Ok hopefully this all makes sense. If further explaing is needed please let me know. Also i would be happy to hear there is an easier way!! Im sure this could be used to do multiple user input commands but i think i am going to take a break before I try to do any more!
  4. meyerforhire

    Interactive Insert VBA

    I'm trying to build a "smarter" insert routine for placing furniture blocks. What I mean by "smarter" is I'd like the user to be able to control, preferably by keystroke, whether to mirror the block or rotate it by a fixed angle on each depression of whatever key I decided. The problem I'm having is I don't even know how to properly "search" for help without finding mounds of nonrelevant information. The biggest issue I can't find resolution for, is being able to keep the block ghosted on my mouse throughout and having that ghosted block update with the user input until it is finaly placed. Really, the rotation could come at the end, I just want to be able to have a visible insert routine with a mirror option. What's frustrating is I know it can be done--I've seen it using a furniture vendor's proprietary ACAD applet. I have been able to take the applet apart--somewhat--but I believe what I'm looking for in this applet is LISP. I don't understand LISP all that great and I'd really like to be able to use VBA. I've been able to get small, digestible snippets of LISP to work in conjunction with VBA, but that's about it. The closest I've gotten so far, is to use several small sub routines--like: Sub BasicInsert() ThisDrawing.ModelSpace.InsertBlock InsPnt(), "TypicalD1", 1, 1, 1, Rot() End Sub Function InsPnt() As Variant Dim Pnt1 As Variant Pnt1 = ThisDrawing.Utility.GetPoint(, "Choose insertion point") InsPnt = Pnt1 End Function Function Rot() Dim rotAng As Double Dim InsPnt As Variant rotAng = ThisDrawing.Utility.GetAngle(, vbCr & "Select Angle:") End Function By closest, I mean I've figured out that I can run sub routines inside of the InsertBlock routine. Really, I don't even know if I'm on the right path with this. Another route I'm considering but don't even know how to invoke is to get VBA to replicate the live action equivalent of grabbing a block by its insertion point grip. You know, when your in ACAD and you highlight a block and then click it's insertion point grip, you now have ahold of that block until you click elsewhere in the drawing to place it. I think if I could figure that out in VBA or LISP, I could get the rest of the stuff to fall in line. Any help would be oh so greatly appreciated. Thanks!
×
×
  • Create New...