All Activity
- Past hour
-
Break an object at 2 points and replace the properties of the line
mhupp replied to Nikon's topic in AutoLISP, Visual LISP & DCL
So went ahead and joined my first part of mine and what Blackbox & Glavcvs posted. Can either run it by typing BD or BreakDash ;;----------------------------------------------------------------------------;; ;; Break Entities and changed layer, linetype, color (defun C:BD () (C:BreakDash) (princ)) (defun C:BreakDash (/ SS1 SS2 SS3 pt1 pt2 ent entdata newent) (setq SS2 (ssadd)) (while (setq SS1 (ssget "_+.:E:S" '((0 . "LINE,POLYLINE,CIRCLE,ARC")))) (setq ent (ssname SS 0) pt1 (getpoint "Select the first break point: ") pt2 (getpoint "Select the second break point: ") LastEnt (entlast) ) (command-s "_.BREAK" ent pt1 pt2) (while (setq LastEnt (entnext LastEnt)) (ssadd LastEnt SS2) ) (setq SS3 (ssget "_W" pt1 pt2 '((0 . "LINE")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS3))) (if (ssmemb ent SS2) (progn (entmod (append ent '((8 . "0") '(6 . "DASHED2") '(62 . 84)))) (entupd ent) ) ) ) ) (princ) ) And found Cab's post for break all objects -
3dwannab started following Multileader justify paragraph doesn't work
-
Multileader justify paragraph doesn't work
3dwannab posted a topic in AutoCAD Bugs, Error Messages & Quirks
Hi all, ACAD 2026 Issue: MLEADER text does not update when setting paragraph alignment to Justify in the editor. Steps to Reproduce: Create a MLEADER with text. Open the text in the MTEXT editor. Set the paragraph alignment to Justify. Close the editor. Expected: Text should be justified. Actual: Text remains left-aligned; Justify has no effect. - Today
-
try this : (defun Fill_Toolbar_Background (x- y- x+ y+ c / y vws bgf-fac delta-y) (setq y y- vws (getvar "viewsize") bgf-fac (/ 0.1 (/ (atof GrM-Button-Background-Fill) 100.0))) (setq delta-y (/ vws 1000.0)) (while (<= y y+)(grdraw (list x- y)(list x+ y) c)(setq y (+ y (* delta-y bgf-fac (/ vws start-viewsize)))))) did very little testing though... oh , about the 'duplicated' background fill , although there are two and the first could (should) have been deleted, it doesn't matter because lisp only evaluates the last version. Every new definition overwites the previous one.
-
Break an object at 2 points and replace the properties of the line
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
PS: Note that I have disabled (40 . 0.25) and (47 . 20) because they are rejected by most objects in your filter, and I haven't taken the time to find out which objects they actually apply to. -
Break an object at 2 points and replace the properties of the line
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Hi As @mhupp mentioned, there are extra 'quotes' marks in your code. Also, as Mhupp suggested, you can use the filter "_+.:E:S" to select the object to be cropped in a single step, and then implement it within a 'while' loop to repeat the operation as many times as needed. Putting all of this together, your code could look something like this: (defun c:Br2ptReplDash (/ ss pt1 pt2 ent entdata newent entUlt) (while (setq ss (SETVAR "NOMUTT" 1) ss (princ "\nSelect object to trim (RIGH CLICK to EXIT)...") ss (ssget "_+.:E:S" '((0 . "*LINE,POLYLINE,CIRCLE,ARC"))) ) (SETVAR "NOMUTT" 0) (setq entUlt (entlast)) (princ "\nSelect the object to split: ") (setq ent (ssname ss 0)) ;; Entering the first break point (setq pt1 (getpoint "\nSelect the first break point: ")) ;; Entering the second break point (setq pt2 (getpoint "\nSelect the second break point: ")) ;; Checking the object type and performing the split (cond ((= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") ;; break the LWPOLYLINE (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "LINE") ;; break the line (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "POLYLINE") ;; break polyline (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "CIRCLE") ;; break the circle (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "ARC") ;; break the arc (command "_.BREAK" ent pt1 pt2) ) (T (prompt "An object of an unsupported type.") ) ) (command "_.LINE" pt1 pt2 "") (if (not (equal entUlt (entlast))) (progn (entmod (append (ENTGET (ENTLAST)) '((8 . "0") ; the default layer (6 . "DASHED2") ; line type ;'(70 . 0) ;(40 . 0.25) ; thickness ;(47 . 20) (62 . 84) ) ) ; LTSCALE ) (princ "\nProcess completed for these objects") (vlr-beep-reaction) ) (princ "\n*** The operation could not be performed ***") ) ) (if (not entUlt) (princ "\nObjects are not selected.")) (princ) ) -
it uses drawing units to fill the background so if your drawing is very large , like site layout or big 3D drawing , yes , then it will take a long time. You can try setting fill in setup to 10% , or I could make it a factor like 1 (vector) line per 1/10 or 1/100 per viewsize. I usually work with standard drawings A4-A0 , also site layouts but most of the time electrical diagrams and instrument loop diagrams. You could switch to paperspace and see what happens. But I will look into making backgroud fill depend of viewsize, should be fairly simple. Probably also make sure ucs is set to view when using menu in 3d drawings , never use 3d for the kind of work I do.
-
I'm trying to get it to work in my AutoCAD 2021, but it takes a very long time to load (about 20 seconds). The problem seems to be with the 'Fill_Toolbar_Background' function (it appears to be duplicated). Could it be that my slow computer is the cause?
-
What Is CAD? Understand CAD: A Comprehensive Guide for Design and Drafting Professionals
The AutoCAD Blog posted a topic in AutoCAD Blogs
What is CAD? Computer-aided design (CAD) is a designation for software specifically created to assist in designing and drafting for architecture, engineering, product development, manufacturing, and nearly any other design purpose. With CAD software, designers can create, edit, and optimize their designs as either 2D drawings or as 3D models. From their humble beginnings in the early 1960s, when IBM and GM collaborated to invent DAC-1 (Design Augmented by a Computer), CAD programs have progressed slowly at first, and lately by leaps and bounds. When Autodesk was founded in 1982, it released AutoCAD, the first CAD software made for desktop personal computers. In the 1990s, CAD systems gradually displayed improved 3D modeling abilities. By the 2000s and beyond, CAD software began expanding its capabilities beyond just 2D and 3D design and modeling. Now, the most advanced CAD products are mighty, cloud-based platforms. They offer automated documentation assistance, powerful simulations of real-world behavior and functionality, photorealistic rendering for lifelike 2D and 3D visualizations, and even animation. Types of CAD Software Different types of modern CAD software are discerned by their ability to aid 2D design, 3D design, or both. 2D CAD Software CAD’s definition can get misconstrued as exclusively 3D design. However, 2D CAD software provides an essential platform for various industries that need precise, flat technical drawings to define shapes and layouts geometrically. Such applications include: Floor plans, construction site layouts, structural documentation, and permit-ready drawings in the architecture, engineering, construction, and operations (AECO) industry. Component and assembly schematics, CNC-ready drawings, technical illustrations, and piping and instrumentation diagrams (P&ID) for manufacturing and industrial engineering. Printed circuit board (PCB) design, control panel schematics, and circuit and wiring layouts for electrical and electronics applications. Furniture and room layouts for interior design. Packaging and labels for the product design industry. For all of these purposes, 2D CAD software like Autodesk AutoCAD LT ensures precise drafting accuracy with full sets of geometric tools that snap to endpoints, midpoints, intersections, and grid lines; layer management; annotation for dimensions, notes, and symbols; file interoperability; and drawing templates that help enforce industry standards. AutoCAD LT supplies all of the above, as well as best-in-class collaboration abilities with cloud connectivity, universal accessibility from web browsers, desktop, and mobile devices; and greatly streamlined workflows from AutoLISP, which offers thousands of pre-existing automations and helps to enforce CAD standards. 3D CAD Software A wealth of 3D CAD software offers deep 3D modeling, rendering, and even animation features, with various strengths and specializations depending on whether the 3D CAD program focuses on aspects of the AECO, product design, manufacturing, or education/training industries. Types of 3D modeling within 3D CAD software offer different tools and capabilities: Parametric modeling: By using constraints and dimensions, the model geometry updates dynamically when changes are made. Direct modeling: The model’s geometry can change with quick edits that aren’t tied to a history of constraints and dimensions. Assembly modeling: Two or more components are modeled into a functional system using motion constraints. Solid modeling: A component or assembly is modeled volumetrically for precision. Surface modeling: This specializes in modeling complex curved surfaces—often with high physical or aesthetic standards—for industrial or product design. Rendering capabilities in 3D CAD software can rival those used in the media and entertainment industries for visual effects and animation. These rendering capabilities allow designers and drafters to create photorealistic visualizations of their designs that accurately simulate materials, textures, and finishes, as well as reproduce lifelike directional or ambient lighting with advanced high-fidelity features like ray tracing, which convincingly reproduces reflections and shadows. Trends in CAD software show that stronger animation features in 3D CAD products are allowing designers to show off their creations in even more spectacular fashion by, for example, animating the exploded view of a product assembly, demonstrating the accurate mechanical movement of a product in detail, or to create sweeping fly-throughs or walk-around presentations using cinematic camera paths. Intuitive timeline editors controls these animations with keyframes and transitions similar to popular video editing apps. All 3D CAD products have similarities, but many of them differentiate by excelling particularly well for certain purposes. Revit, for example, specializes in Building Information Modeling (BIM) for architecture, infrastructure, and MEP (mechanical, electrical, and plumbing) systems. Inventor’s advanced parametric and assembly modeling with powerful simulations make it a favorite for industrial design and mechanical engineering. In addition to parametric, direct, and freeform CAD modeling, Fusion includes computer-aided manufacturing (CAM), computer-aided engineering (CAE), and PCB toolsets, making it ideal for product design and manufacturing, as well as electronics engineering. AutoCAD offers both 2D and 3D CAD tools for design and drafting and has been trusted amongst architecture, construction, and product engineering professionals for decades. All four of these Autodesk 3D CAD solutions include high-end rendering and animation functionality, AI-assisted workflow streamlining, and cloud connectivity with world-class collaboration abilities. Specialized CAD Toolsets In some cases, uniquely specialized CAD software products, or specific toolsets within larger CAD software, offer hyper-focused abilities, directly tailored for certain industries. AutoCAD specialty toolsets: AutoCAD has seven add-on toolsets that increase productivity with thousands of intelligent objects or symbols, as well as enhanced features. For example, AutoCAD Architecture Toolset‘s 8,800+ architectural components like doors, windows, and walls help with automated generation of floor plans, ceiling grids, and more. AutoCAD Mechanical Toolset automates BOM (bill of materials) creation and includes 700,000+ parts and features for mechanical engineering and manufacturing. AutoCAD Electrical Toolset automates wire numbering and component tagging with the aid of 65,000+ intelligent electrical symbols. The 10,500+ intelligent pipes, fittings, ducts, and other objects in the AutoCAD MEP Toolset greatly increase MEP design productivity. Civil 3D: For civil engineering design and documentation, Civil 3D supplies complex infrastructure tools in a 3D modeling environment. These include terrain modeling, corridor design, stormwater and sanitary sewer analysis, and automation assistance for tasks like grading optimization, pipe layout, and more. Advance Steel: Built for structural steel detailing and fabrication, Advance Steel 3D steel design software assists with parametric steel connections, folded plate modeling, and stairs, railings, and cage ladders. It automatically generates steel fabrication deliverables like shop drawings and NC files. Its Dynamo Extension also automates repetitive tasks like making parametric steel connections. Advance Steel integrates with Revit, Navisworks, and others to make your workflow smooth. Benefits of Using CAD Out of CAD’s many benefits, the major advantages include improved accuracy, efficiency, collaboration, presentation, and everybody’s favorite: cost savings. Increased drafting precision and accuracy Designers enjoy the highest level of accuracy in their CAD models, all the way down to the micrometer (one millionth of a meter). This precision comes at a fast pace as well. Dimension tools, constraints, and snap grids help designers and drafters work quickly, while doing away with manual drafting errors. With parametric modeling, precise geometries stay accurate and consistent despite numerous revisions. Improved design quality and efficiency CAD tools speed up design and drafting tasks in myriad ways. Preloaded templates jumpstart similar projects and often build-in standards to adhere to. Libraries of common reusable components, symbols, and other elements maintain consistency while boosting work speed. Advanced CAD software can also automate a number of processes, such as generating BOMs and annotations. Enhanced collaboration and communication Integrated documentation within CAD software improves clear communication with both internal and external collaborators, like manufacturers. It’s easy to track revisions with markup tools and version control. Autdodesk’s CAD options with cloud connectivity also allow multiple users to collaborate on a project simultaneously from any device. Cost savings and less rework Simulation and analysis tools in CAD software help to detect design flaws early in the process, cutting down on rework stemming from errors and contributing to cost efficiency. Highly detailed and accurate documentation also reduces mistakes, rework, and material waste in the fabrication stage. Automation functions in some CAD software reduce the time needed for tedious, repetitive design and drafting tasks, allowing more work to be done in less time. Better visualization and presentation The photorealistic and engaging results of high-end CAD software’s 3D rendering and animated walkthroughs or exploded views impress stakeholders with vivid presentations. This helps especially when seeking approvals from non-technical audiences. These animation and simulation tools can convey real-world functionality, so you can make tweaks before expending resources on physical prototypes. CAD applications across industries Industries benefitting most from CAD include AECO, product design and manufacturing, and other related custom design industries. Architecture, engineering, and construction (AEC) Every piece of the AEC industry feels the impact of CAD technology, from initial architectural concepts to the monitoring of a BIM digital twin for building lifecycle management. CAD fuels the architectural design process, including floor plans, elevations, and sections. It’s also critical for presenting building and interior designs with animated 3D walkthroughs and stunning architectural visualizations. Specialty tools like Revit and Advance Steel provide structural engineers with vital abilities like load analysis, reinforcement, and steel detailing. Meanwhile, options like AutoCAD MEP use intelligent object modeling to streamline the design of HVAC, electrical, and plumbing systems. Larger infrastructure and civil works projects also benefit from CAD software like Civil 3D to facilitate terrain modeling, grading, and other site planning and infrastructure design jobs. These same CAD tools can continue to feed data into the BIM digital twin of a finished building for lifecycle management and clash detection. Manufacturing The influence of CAD applications has helped the manufacturing industry reach new heights of precision and efficiency. For example, parametric modeling tools like Inventor are critical for designing the highest-performance mechanical components, assemblies, and tooling. Sheet metal and mold design are more efficient than ever with special features for sheet metal unfolding and nesting and for creating injection molds. Advanced CAD software’s capacity for high-level simulation allows virtual thermal and stress testing, as well as analyzing a product’s material behavior and motion dynamics before the prototyping and fabrication stages. Some CAD software, like Fusion, integrate CAM and can export data directly to CNC machines and 3D printers for rapid prototyping and custom or small-batch production. CAD modeling tools also integrate with product lifecycle management (PLM) systems to inform their version control and compliance. Product design Designers of some of the most intricate and high-performance products get special creative and functional assistance from CAD software. For example, industrial designers can experiment with the most sculpted surfaces, the most ergonomic modeling, and the most refined aesthetics with a tool like Autodesk Alias. And electronics engineers have dedicated capabilities in Fusion like PCB layout, thermal simulations, and enclosure design. Fusion also includes extensive generative design abilities to explore thousands of quickly generated design permutations based on the designer’s constraints. The software can also export the design to CNC machines or 3D printers for iterative prototyping. Product design also gains marketing and client visibility with CAD software’s built-in visualization and rendering for creating photorealistic graphic and animated presentations. General design and drafting applications Apparel designers make use of CAD for drafting patterns, simulating garments, and textile layout. Interior designers can strategize furniture and cabinetry layouts and visualize materials. Commercial designers model and test packaging solutions, design signage, and layout trade booth or retail displays. Jewelry designers appreciate the exacting precision of CAD software for casting and stone setting. The Future of CAD A wealth of exciting emerging trends in CAD technology point to CAD tools becoming even more central creative hubs for the industries they serve, with wide-ranging implications for the design and drafting professions. Emerging trends in CAD Most of these future trends in CAD are already underway in the advanced CAD tools that are available now, but they will become even more important for industry professionals and industries to adopt. For example, cloud-based CAD software—like Autodesk’s CAD tools—will become an essential feature of workflows, as they allow designers and all their colleagues and stakeholders to work and collaborate from anywhere on any device. Distributed hybrid and remote teams immediately see the advantages of simultaneous multiple users being able to review, edit, and comment. Cloud platforms like Fusion perform processing in the cloud, putting less pressure on users’ machines and allowing businesses to scale. AI functions will also become more prevalent. Machine learning already drives generative design and predictive analysis to detect potential performance issues and suggest geometries and materials. Other automation tools on the market include AI-assisted block placement and quantity tracking in AutoCAD LT and automated dimensioning, component placement, and error checking. CAD companies’ continued research into integrating AI will automate more repetitive tasks for greater accuracy and to free up designers and drafters for the more creative aspects of their work. CAD software’s visualization capabilities are already quite impressive, but as VR and AR technology matures and gains wider adoption, CAD tools will offer immersive XR (extended reality) presentations of building walk-throughs, automotive walk-arounds, and so on. These presentations could happen remotely in VR or in physical locations using AR overlays to see how 3D models would look in the real world. As the methods and materials behind 3D printing continue to advance, there will be greater options for not only rapid prototyping but also more viable production runs using additive manufacturing and hybrid manufacturing—a combination of additive manufacturing and subtractive manufacturing from CNC machines. This will make design for additive manufacturing (DfAM) a more significant consideration for product designers and engineers if additive can provide an equal-quality product faster and/or for less money. And CAD tools like Fusion with integrated CAM will be able to handle the iterative development of a product from concept to production—all within a single platform. Sustainability and the quest for a circular economy are here to stay and even more viable thanks to the trends in CAD technology. CAD software’s simulation abilities include energy use simulations, daylight analysis for optimizing the natural light and temperature implications in buildings, and material impact assessments to help make more eco-conscious material choices. CAD software also enables digital twins—real-time replicas of physical products, buildings, and larger systems—which use big data streams and AI for predictive maintenance and lifecycle optimization. Future impact on designers and drafters All these emerging trends in CAD enforce what was already a momentous shift away from CAD being just a drafting tool to CAD platforms being centralized creative and collaborative hubs for designers and businesses. This shift will impact design and drafting professions. For one thing, there’s inertia away from 2D drafting and more toward intelligent 3D modeling capable of collecting product lifecycle data for informing BIM and product digital twins. Professionals in these fields would do well to add parametric modeling, CAD simulation, and interdisciplinary coordination skills to their repertoire. The jobs may evolve further into being more like design strategists and creative technologists, where they use more automation and AI tools to realize their creativity and to optimize collaborative workflows. Return-to-office (RTO) orders are trendy in certain tech-focused businesses for now, but what will happen when cloud-based CAD becomes the norm and enables cross-border remote teamwork to be as effective and fruitful as ever? Also, the increasing accessibility of advanced CAD features, AI tools, and cloud-based processing should theoretically empower smaller studios and individuals to compete with larger operations for jobs. Design and CAD modeling education is also evolving to become more accessible to more people and to emphasize concepts like digital manufacturing, systems thinking, and sustainability. Employers and employees alike will need to embrace lifelong learning in order to advance along with the evolving CAD technology. Careers in CAD Discover the opportunities, industry demand, and qualifications needed for today’s CAD careers. Career paths and opportunities As CAD tools and platforms become more capable and more central to design businesses, there’s never been a more exciting time to pursue these CAD careers. CAD drafters/technicians produce 2D or 3D technical drawings for the AECO and manufacturing industries. CAD designers create detailed 3D models and prototypes, often with their own freedom to make design decisions. CAD engineers in fields like civil infrastructure or mechanical engineering add engineering analysis—like finite element analysis (FEA)—to CAD design duties. BIM coordinators manage building information models in the AECO industry. Specialist CAD roles hone in on specific areas like piping layouts, electrical schematics, or fashion pattern drafting. CAD leadership roles advance from previous positions into jobs like project manager, CAD manager, and design lead. Required skills and qualifications To begin a CAD career, the top requirement is proficiency in one or more of the leading CAD toolsets, such as AutoCAD, Revit, Fusion, Civil 3D, or Inventor. Technical knowledge is also key, including engineering principles, geometry, spatial reasoning, and drafting standards. Soft skills are also highly desirable. These include things like attention to detail in order to avoid errors in manufacturability, compliance and so on. Communication and collaboration soft skills are also more important than ever to work with interdisciplinary team members and clients who may be entirely non-technical. Skilled people who can demonstrate CAD proficiency without educational credentials can find employment. However, a bachelor’s degree or at least an associate’s degree in drafting, design, or engineering is typical for CAD careers. One can also boost both their skills and credibility by earning certs, such as the many Autodesk Certifications. Industry demand and job outlook for CAD careers The outlook for CAD careers is still strong, although traditional drafting jobs are on a bit of a decline, while hybrid roles that combine CAD with a BIM specialty or engineering are in more demand. The AECO industry needs CAD professionals for BIM design and operations, MEP systems, building plans, and more. Likewise in civil engineering and infrastructure, CAD skills are essential in the design, building, and support of projects such as roads, bridges, waterworks, and other utilities. In manufacturing and product design, CAD pros are vital for prototyping, tooling, and other aspects of CAM integration. Across industries, there are growing opportunities to merge CAD skills with the expanding areas of XR (VR, AR, and mixed reality), sustainable design, and 3D printing/additive manufacturing. Professional development and advancement Workers at every stage of their CAD careers will likely benefit from continual learning, upskilling, and focusing strategically on in-demand skills, like generative design, simulation, and parametric modeling. Continuing education, whether advanced degrees or modular options like courses and certifications, can build your reputation and yield projects to show in a professional portfolio. Networking through professional associations or conferences can help advance a CAD career while also being learning opportunities. Getting Started with CAD While there’s no wrong way to get started with CAD, some thoughtful choices will help to use your time wisely. Think about your end goals, like if you want to learn 2D CAD drafting, 3D CAD modeling, or both, and whether you want to specialize in CAD for a particular industry. Also consider whether you need software made for beginners or are already comfortable with technical software. Do you need free software, or do you have a budget? Free software usually has a limited feature set, but can be very handy for first-time learners. Do you prefer browser-based web apps, or are you okay with downloaded software? For 2D drafting, AutoCAD LT is a great place to start. For beginner-friendly 3D CAD, Fusion has an inviting interface, a limited free version for personal use, and tons of free tutorials to get started. The place to go for a free 3D CAD web app for absolute beginners is Tinkercad, and make sure to check out the free tutorials in the Tinkercad Learning Center. However, if you’re ready to jump into serious CAD software that offers both 2D and 3D CAD and is entrenched across various industries, consider one of the versions of AutoCAD. The best option for students, casual users, and less active CAD collaborators is AutoCAD Web, the affordable, web and mobile version with limited but essential AutoCAD features for basic designs and light editing. AutoCAD Web’s features also come included with AutoCAD LT and the full version of AutoCAD, the go-to solution for industrial designers and AECO professionals needing 2D/3D technical drawings and CAD models. It has customizable workflows and many helpful automations that make large-scale projects more manageable. If you specialize in a certain field, seven AutoCAD Toolsets provide thousands of intelligently adapting objects and elements for your designs, as well as purpose-built workflow enhancements for specific professional needs. These toolsets serve architects (Architecture toolset), mechanical engineers (Mechanical toolset), electrical engineers (Electrical toolset), MEP contractors (MEP toolset), plant designers (Plant 3D toolset), GIS professionals (Map 3D toolset), and surveyors and archivists (Raster Design toolset). Exploring the Future Advancements of CAD Tools While CAD’s definition of computer-aided design has remained, CAD’s meaning to design and drafting professionals and businesses has undergone seismic shifts over decades of development. Using advanced CAD tools to their fullest extent benefits users with much greater precision and accuracy, design quality, and efficiency. Cloud-connected CAD platforms improve communication and collaboration. Rendering and animation make for better presentations and visualizations. Perhaps most importantly, by increasing accuracy while also streamlining workflows, CAD tools reduce both rework and overall production costs—essential as firms face tighter budgets. The near future promises even more CAD advancements and more incentives for industries to optimize their CAD use. New AI-assisted automations will continue to streamline workflows. Maturing 3D printing technologies will allow CAD/CAM systems to command new prototyping and custom manufacturing options. XR will expand CAD’s presentation and collaboration possibilities. Also, CAD tools will play a larger part in sustainability, helping designers and builders choose more eco-friendly materials, design more recyclable or reusable products, and produce more locally. All of this makes the industries relying on CAD exciting places to be, while also spelling change on the horizon for design and drafting professionals. Adopting new skills and technologies, as well as a mindset of lifelong learning can help to stay relevant and employed in the expanding, creative world of CAD. The post What Is CAD? Understand CAD: A Comprehensive Guide for Design and Drafting Professionals appeared first on AutoCAD Blog. View the full article -
BlackBox started following Break an object at 2 points and replace the properties of the line
-
Break an object at 2 points and replace the properties of the line
BlackBox replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Entlast & entnext may help to mitigate that. 1+ -
Break an object at 2 points and replace the properties of the line
mhupp replied to Nikon's topic in AutoLISP, Visual LISP & DCL
You start the lisp with if this will only run once. changing the if to while will allow you to use the break command multiple of times with out having to type the command over and over. only draw back is if you only want to run the command once you have to right click or hit enter to exit the command. using ssget with the "_+.:E:S" acts like entsel and will only select entity's you define. eliminating the need to test the entity type. since you have the two break points defined you can use ssget with the window option to "select" that entity but could pick up other smaller unwanted items also. this is all moot because id recommend using Breakall by CAB. don't know if its on here but he posted it on theswamp.org many years ago. alot more features and error handling. -
Break an object at 2 points and replace the properties of the line
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I understand (), but the rest is not very clear... -
mhupp started following Break an object at 2 points and replace the properties of the line
-
Break an object at 2 points and replace the properties of the line
mhupp replied to Nikon's topic in AutoLISP, Visual LISP & DCL
This is a bit more streamlined. ;; AutoLISP, which allows you to select objects (line, polyline, circle, arc), ;; break them at two points and replace the selected section with a dashed line with the specified parameters (defun c:Br2ptReplDash (/ SS pt1 pt2 ent entdata newent) ;while instead of if allows this command to be repated as long as you select an entity. (while (setq SS (ssget "_+.:E:S" '((0 . "LINE,POLYLINE,CIRCLE,ARC")))) ;Will emulate an entsel selection behaviour and only allows the entity types listed (progn ;no need for cond check now (setq ent (ssname SS 0)) (setq pt1 (getpoint "Select the first break point: ")) (setq pt2 (getpoint "Select the second break point: ")) Using the two points create a selection set window to pick up created break line (ssget "_W" pt1 pt2 '((0 . "LINE"))) Your entmod has to many ( ) (entmod (append newent '((8 . "0") ; the default layer '(6 . "DASHED2") ; line type '(40 . 0.25) ; thickness '(47 . 20) ; LTSCALE '(62 . 84) ; Add here instead of 2nd (entmod (append newent '((62 . 84)))) ) ) ) ;removed 2nd '(6 . "DASHED2") -
Break an object at 2 points and replace the properties of the line
CivilTechSource replied to Nikon's topic in AutoLISP, Visual LISP & DCL
few issues with the lisp. 1) The ssget does not seem to work. 2) Creating a new line between breakpoints will not work for circles as you need to create an arc. It will also not work on curved polylines. Maybe a better way to approach it, is to select the object copy it. Trim it to pt1 & pt2 and then, break the selected objected between pt1 & pt2? -
Serious UI Failure in OpenDCL Studio - 'Options' and 'New Project' Menus are Missing
SLW210 replied to duke's topic in AutoLISP, Visual LISP & DCL
I do not see any screen shots. Current Build [9.3.1.1] (The current build is always under development. It is where we add new features for testing. It's usually very stable, but may contain a few bugs.) Did you try the stable version? Stable Build [9.1.5.2] (The stable build has all the known bugs worked out, but may not be as up-to-date as the current build.) According to the response on the OpenDCL forum, those sub menus do not exist. Serious UI Failure in OpenDCL Studio - 'Options' and 'New Project' Menus are Mis As far as I can tell, AutoCAD 2021 was the first version for Windows 11, so there could be issues there. -
Break an object at 2 points and replace the properties of the line
Nikon posted a topic in AutoLISP, Visual LISP & DCL
The code should draw a dotted new line between the points, but the line is not drawn. Would it be easier to change the properties of the line between two points? Thanks... ;; AutoLISP, which allows you to select objects (line, polyline, circle, arc), ;; break them at two points and replace the selected section with a dashed line with the specified parameters (defun c:Br2ptReplDash (/ ss pt1 pt2 ent entdata newent) (setq ss (ssget '((0 . "LINE,POLYLINE,CIRCLE,ARC")))) (if ss (progn (prompt "Select the object to split: ") (setq ent (ssname ss 0)) ;; Entering the first break point (setq pt1 (getpoint " Select the first break point: ")) ;; Entering the second break point (setq pt2 (getpoint " Select the second break point: ")) ;; Checking the object type and performing the split (cond ((= (cdr (assoc 0 (entget ent))) "LINE") ;; break the line (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "POLYLINE") ;; break polyline (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "CIRCLE") ;; break the circle (command "_.BREAK" ent pt1 pt2) ) ((= (cdr (assoc 0 (entget ent))) "ARC") ;; break the arc (command "_.BREAK" ent pt1 pt2) ) (T (prompt "An object of an unsupported type.") ) ) ;; Get new objects after splitting (setq ss (ssget "_N" '((0 . "LINE POLYLINE CIRCLE ARC")))) ;; Sorting through objects and replacing the section with a dotted line (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) (setq entdata (entget ent)) ;; Create a new line between the break points (setq newent (command "_.LINE" pt1 pt2 "")) ;; Setting up line properties (entmod (append newent '((8 . "0") ; the default layer '(6 . "DASHED2") ; line type ;'(70 . 0) '(40 . 0.25) ; thickness '(47 . 20))) ; LTSCALE ) ;; Color setting (entmod (append newent '((62 . 84)))) (setq i (1+ i)) ) (prompt "Processing is completed.") ) (prompt "Objects are not selected.") ) (princ) ) Br2ptReplDash.dwg -
Function to calculate Mtext Justification based on Rotation
GLAVCVS replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
Even if you create MTEXT objects without referencing any other object, they will still have some kind of arbitrary geometry. You could establish a rule that the perimeter points are always entered in a clockwise order This would allow the code to have the necessary criteria to determine what is inside and outside the perimeter. Additionally, the code could dynamically draw a perimeter based on each insertion point specified by the user. As a convention for these temporary perimeters, you could assign them a specific, distinct color. All of this could later allow you to write code for another command that manages these perimeters and their associated MTEXT objects, and then replaces them with the final, definitive version. -
Function to calculate Mtext Justification based on Rotation
CivilTechSource replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
@GLAVCVS You are absolutely correct. Ideally the user will select the polyline which represents a house and we calculate to place the text outside. However, we do not always get the building outline from the architects as a single polyline and I do not wish to spent time creating that polyline (for now). So I am focusing on at least having the correct Left/Right justification.... Unless I use something similar to LeeMacs Text Alignment Controls https://www.lee-mac.com/curvealignedtext.html . But at the moment this is slightly over my head for now. However, we could solve this issue without taking in consideration of geometry and take a similar approach to how you set the UCS, by selecting 3 points. p1-TextPlacement p2-Text Left & Right Justification based on p1 p3-Text Top & Right Justification based on p1 & p2 Would that work? -
duke started following Serious UI Failure in OpenDCL Studio - 'Options' and 'New Project' Menus are Missing
-
Hello everyone, I'm new to OpenDCL and I'm having a very strange issue with my installation. The OpenDCL Studio interface is not displaying correctly, which is preventing me from getting started. **The Problem:** Key menu items are completely missing. 1. In the "Tools" menu, the "Options..." item is missing. 2. In the "File > New" menu, the "Project" option is missing, so I cannot create a new project. **My System Information:** - Operating System: Windows 11 - AutoCAD Version: AutoCAD 2020 (English) - OpenDCL Version: 9.3.1.1 **What I've already tried without success:** - A complete uninstall/reinstall of OpenDCL. - Rebooting the PC. - Trying both the Spanish (ESM) and the main English installers. In all cases, the result is exactly the same. I have attached screenshots showing the missing menu items. Has anyone seen this fundamental issue before or have any ideas what might be causing this conflict on my system? I know this forum is for general LISP, but I'm hoping someone here might have run into this OpenDCL issue before. Any help would be greatly appreciated. Thank you.
-
Get length of MLeader/QLeader spline.
BIGAL replied to SLW210's topic in AutoLISP, Visual LISP & DCL
New answer, when you draw a pline did you know you can pick start point, drag mouse for next point, BUT type in length no need for "L". Tested seems to work ok in original code. Starting point of Mleader Enter to stop : : _pline Select start of polyline or [Follow] <Last point>: Set next point or [draw Arcs/Distance/Follow/Halfwidth/Width]: 50 Set next point or [draw Arcs/Distance/Follow/Halfwidth/Width/Undo]: 75 Set next point or [draw Arcs/Close/Distance/Follow/Halfwidth/Width/Undo]: 100 Set next point or [draw Arcs/Close/Distance/Follow/Halfwidth/Width/Undo]: Existing length is 225 Enter new length 220 Enter label AAA Ok fixed the defun code, its messages may have been misleading. (defun plpts ( / pt) (command "_pline" (getpoint "\nStarting point of Mleader : ")) (while (= (getvar "cmdactive") 1 ) (command (getpoint (getvar 'lastpoint))) ) ) -
@rlx will definitely have a look at it, your dcl stuff is great. One thing you can do is unzip a zip file using lisp, so could have all the files and a DAT file and save them to a known directory, as part of my Install.lsp it adds the support paths and load the toolbar. The reason for comment was I used CIV3D so I had a custom menu that had often used Civ3D commands, this saved having to change workspaces. You just have to open the CUI and copy the commands to say notepad.
-
Get length of MLeader/QLeader spline.
BIGAL replied to SLW210's topic in AutoLISP, Visual LISP & DCL
Ok simple maybe I didn't use the "L" option rather, just pick 2 3 or 4 points. I can change it pretty quick to just convert a pline. A quick fix change the three lines in the code. ;;;;;;;; starts here ;(plpts) ;(setq ent (entlast)) (setq ent (car (entsel "\nPick a pline "))) Will do the front end later today. Set text size etc. Do you want a dogleg ? - Yesterday
-
you're absolutely right GLAVCVS , took out too much when I cleaned out some obsolete code. Usually I forget the 'void' function but paid special attention I didn't this time. At the expense of rlx_sf this time so it seems. Have done a few changes , renamed orientation to justification (change with letter j / J while menu is displayed) , change (background) color with b (or B) and with keys c / C & r / R decrease / increase columns & rows. Hope all the bugs are dead now... ;;; GrM - Graphic Menu , Rlx sep '25 ;;; Known limitations : keep app names short , use fixed width & height not really useful, probably gonna remove that ;;; option was intended to be able to have like a 4x4 in center of screen and not fill entire screen... maybe later.. ;;; last update : 2025-09-04 - cleaned up & connected dialog with subroutines ;;; : 2025-09-05 - did some further t&c (tweaking & cleaning) ;;; : 2025-09-06 - time for fieldtesting ;;; : 2025-09-07 - fixed a couple of 1st use issues ;;; : 2025-09-10 - included rlx_sf (defun c:GrMS ( / ;;; globals regkey regvar reg-var-list old-err screen-width screen-height GrM-NoF-Columns GrM-NoF-Rows start-toolbar cell-height cell-width x y cell-number app-list corner start-viewsize app default-button-width default-button-height ;;; test variables so I can run program without dialog tst-NoF-Rows tst-NoF-Columns tst-cell-height tst-cell-width ;;; dimscreen : view x-/y-/x+/y+/height/width/center vx- vy- vx+ vy+ vh vw vc ;;; toolbar corner points tb-x- tb-x+ tb-y- tb-y+ tb-ll tb-ul tb-lr tb-ur tb-dX tb-dY ;;; setup dialog variables setup-dialog-fn setup-dialog-fp setup-dialog-dcl setup-dialog-tl setup-dialog-rd ;;; registry GrM-NoF-Rows ;;; Number of rows in menu , left-right (vertical) Justification GrM-NoF-Columns ;;; Number of columns in menu , left-right (vertical) Justification GrM-Button-Background-Fill ;;; 100(%) means 1 vector line per unit GrM-Button-Width-Height-Ratio ;;; width-ratio 2 means cell width is 2 x cell height GrM-Max-Button-Width-Height-Ratio ;;; set on 3 (width is max 3 times button height) GrM-Max-Button-Background-Fill ;;; 0-100 (%) in steps of 10 GrM-Use-Fixed-Cell-Height ;;; boole , "0" = nope , "1" = jip GrM-Cell-Height ;;; 10 means screen width / 10 GrM-Use-Fixed-Cell-Width ;;; boole , "0" = nope , "1" = jip GrM-Cell-Width ;;; 10 means screen height / 10 GrM-Frame-Color ;;; default is "7" (white) GrM-Text-Color ;;; default is "7" (white) GrM-Background-Color ;;; colors like "8" (gray) , "143" (dirty blue) ;;; options GrM-Max-Columns GrM-Max-Rows ;;; Limmits on number of columns & row GrM-Follow-Justification GrM-Sort-On-Load ;;; Swap #rows - #cols when switching Left/Right - Top/Center/Bottom GrM-Text-Size-Factor ;;; usually 9 or 10 GrM-Toolbar-Justification ;;; left/right/top/bottom/center GrM-App-List-File GrM-Debug-Mode ;;; if "1" function inspect displays variables & values ) ;;; initialyze environment (set_reg_var_list) (princ "\nstart GrM ... ") (GrM_Init) (princ "start setup dialog\n") ;;; (chk_reg_vars) ;;; debug on;y (GrM_Setup_Dialog_Start) (GrM_Exit) (princ) ) (defun c:GrM ( / regkey regvar reg-var-list old-err screen-width screen-height GrM-NoF-Columns GrM-NoF-Rows cell-height cell-width x y cell-number app-list corner vx- vy- vx+ vy+ vh vw vc tb-x- tb-x+ tb-y- tb-y+ tb-ll tb-ul tb-lr tb-ur tb-dX tb-dY setup-dialog-fn setup-dialog-fp setup-dialog-dcl setup-dialog-tl setup-dialog-rd app default-button-width default-button-height GrM-NoF-Rows GrM-NoF-Columns GrM-Button-Background-Fill GrM-Button-Width-Height-Ratio GrM-Max-Button-Width-Height-Ratio GrM-Max-Button-Background-Fill GrM-Use-Fixed-Cell-Height GrM-Cell-Height GrM-Use-Fixed-Cell-Width GrM-Cell-Width GrM-Frame-Color GrM-Text-Color GrM-Background-Color GrM-Max-Columns GrM-Max-Rows GrM-Follow-Justification GrM-Sort-On-Load GrM-Text-Size-Factor GrM-Toolbar-Justification GrM-App-List-File GrM-Debug-Mode) ;;; initialyze environment (set_reg_var_list) (princ "\nstart GrM ... ") (GrM_Init) (princ "start toolbar\n") ;;; (chk_reg_vars) ;;; debug only (GrM_Draw_Toolbar) (if (eq GrM-Debug-Mode "1") (inspect (list 'vh 'vw 'GrM-Toolbar-Justification 'GrM-NoF-Columns 'GrM-NoF-Rows 'GrM-Use-Fixed-Cell-Height 'GrM-Cell-Height 'cell-Height 'GrM-Use-Fixed-Cell-Width 'GrM-Cell-Width 'cell-width 'GrM-Frame-Color 'GrM-Text-Color 'GrM-Background-Color ) ) ) ;;; get user input (GrM_Start_GrRead) (GrM_Exit) ;;; launch app (if app (GrM_Start_App app)) ) (defun set_reg_var_list () (setq reg-var-list (list 'GrM-NoF-Rows 'GrM-NoF-Columns 'GrM-Button-Background-Fill 'GrM-Button-Width-Height-Ratio 'GrM-Max-Button-Width-Height-Ratio 'GrM-Max-Button-Background-Fill 'GrM-Use-Fixed-Cell-Height 'GrM-Cell-Height 'GrM-Use-Fixed-Cell-Width 'GrM-Cell-Width 'GrM-Frame-Color 'GrM-Text-Color 'GrM-Background-Color 'GrM-Max-Columns 'GrM-Max-Rows 'GrM-Follow-Justification 'GrM-Sort-On-Load 'GrM-Text-Size-Factor 'GrM-Toolbar-Justification 'GrM-App-List-File 'GrM-Debug-Mode ) ) ) (defun GrM_Init () ;;; error handler (setq old-err *error* *error* GrM_Err) ;;; setup default data list (unless it exists) (create_default_data_file "c:\\temp\\GrM-Rlx.dat") ;;; init registry variables (InitDefaultRegistrySettings)(ReadSettingsFromRegistry) ;;; record viewsize at session begin (setq start-viewsize (getvar "viewsize")) ;;; get app-list if any (GrM_Preload_App_List) ;;; fixed button height / width is viewsize / factor (default = 12) (setq default-button-height (/ (getvar "VIEWSIZE") 10) default-button-width (* default-button-height 2.0)) ) (defun GrM_Err ($s) (princ (strcat "\n\n\n" $s))(GrM_Exit)(setq *error* old-err)(gc)(princ)) (defun GrM_Exit () ;;; dialog (if (not (null setup-dialog-dcl))(unload_dialog setup-dialog-dcl)) (if (not (null setup-dialog-fp))(close setup-dialog-fp)) (if (and (not (null setup-dialog-fn))(findfile setup-dialog-fn))(vl-file-delete setup-dialog-fn)) ;;; flush cache (redraw)(gc)(terpri)(princ "\r\n")(princ) ) ;;; --- Registry Settings ------------------------------- Begin Registry Settings ------------------------------- Registry Settings --- ;;; (defun InitDefaultRegistrySettings () (record "InitDefaultRegistrySettings") (setq regkey "HKEY_CURRENT_USER\\SOFTWARE\\GrM\\") ;;; regkeys must be strings ;;; ("variable name" "default value") (setq regvar '( ("GrM-NoF-Rows" "10") ;;; Number of rows in menu , left-right (vertical) Justification ("GrM-NoF-Columns" "1") ;;; Number of columns in menu , left-right (vertical) Justification ("GrM-Button-Background-Fill" "100") ;;; 100(%) means 1 vector line per unit ("GrM-Max-Button-Background-Fill" "100") ;;; value between 10-100 (%) in steps of 10 ("GrM-Button-Width-Height-Ratio" "2") ;;; width-ratio 2 means cell width is 2 x cell height ("GrM-Max-Button-Width-Height-Ratio" "3") ;;; limit on how many times the height the width of the button can be. ("GrM-Use-Fixed-Cell-Height" "0") ;;; boole , "0" = nope , "1" = jip ("GrM-Cell-Height" "") ;;; 10 means screen width / 10 ("GrM-Use-Fixed-Cell-Width" "0") ;;; boole , "0" = nope , "1" = jip ("GrM-Cell-Width" "") ;;; 10 means screen height / 10 ("GrM-Frame-Color" "7") ;;; default is "7" (white) ("GrM-Text-Color" "7") ;;; default is "7" (white) ("GrM-Background-Color" "8") ;;; colors like "8" (gray) , "143" (dirty blue) ("GrM-Max-Columns" "10") ;;; Limmits on number of columns ("GrM-Max-Rows" "10") ;;; Limmits on number of rows ("GrM-Follow-Justification" "1") ;;; Swap #rows - #cols when swapping Left/Right - Top/Center/Bottom ("GrM-Sort-On-Load" "1") ;;; Sort app-list upon load ("GrM-Text-Size-Factor" "9") ("GrM-Toolbar-Justification" "left") ;;; left/right/top/bottom/center ("GrM-App-List-File" "c:\\temp\\GrM-Rlx.dat") ("GrM-Debug-Mode" "0") ;;; hidden image button &d toggles dubug ) ) (mapcar '(lambda (x)(set (read (car x)) (cadr x))) regVar) ) (defun ReadSettingsFromRegistry () (record "ReadSettingsFromRegistry") (mapcar '(lambda (x / n v) (if (setq v (vl-registry-read regkey (setq n (car x)))) (set (read n) v) (vl-registry-write regkey n (cadr x)))) regvar)) (defun WriteSettingsToRegistry () (record "WriteSettingsToRegistry") (mapcar '(lambda (x) (vl-registry-write regkey (car x) (eval (read (car x))))) regvar)) ;;; (setq a 1 b t c "") (vl-every 'boundp (list 'a 'b 'c)) -> T ;;; (setq a 1 b nil c "") (vl-every 'boundp (list 'a 'b 'c)) -> nil (defun chk_reg_vars () (if (not (vl-every 'boundp reg-var-list)) (progn (princ "\n * reg var err - attempting to reload *") (gc) (ReadSettingsFromRegistry))) (if (not (vl-every 'boundp l)) (progn (alert " * reg var err - please reload GrM *")(exit))) ) ;;; --- Registry Settings -------------------------------- End Registry Settings -------------------------------- Registry Settings --- ;;; ;;; --- dialog section ----------------------------------- begin dialog section ------------------------------------ dialog section --- ;;; ;;; --- dialog section ----------------------------------- begin dialog section ------------------------------------ dialog section --- ;;; ; SaveDialogData evaluates all vars from %tl and returns them as a list, reset does the opposite (defun Save_Setup_Dialog_Data (%tl) (mapcar '(lambda (x) (eval (car x))) %tl)) (defun Reset_Setup_Dialog_Data (%tl %rd) (mapcar '(lambda (x y) (set (car x) y)) %tl %rd)) (defun Set_Setup_Dialog_Tiles (%tl) (mapcar '(lambda (x / v) (if (eq 'str (type (setq v (eval (car x))))) (set_tile (cadr x) v))) %tl)) (defun Setup_Dialog_Cancel () (Reset_Setup_Dialog_Data setup-dialog-tl setup-dialog-rd) (WriteSettingsToRegistry)) ;;; --- dcl plus-minus block -------------------------------------------------- ;;; _____ ;;; No. Dragons | 1| [ + ] [ - ] ;;; ----- ;;; k = key (will be prexid with eb_ & bt_ / app-list = label / w = edit box width ;;; (dcl_plus_min "rlx" "No. Dragons" "3") ;;; --------------------------------------------------------------------------- (defun dcl_plus_min (k app-list w) (strcat ":row {children_fixed_width=true;" ":text {fixed_width=true;width=10;label=\"" app-list "\";}" ":edit_box {key=\"eb_" k "\";edit_width=" w ";}" ":button {key=\"bt_" k "_plus\";label=\"+\";}" ":button {key=\"bt_" k "_min\";label=\"-\";}spacer;}" ) ) (defun dcl_button_image1 (k app-list) (strcat ":button {fixed_width=true;width=18;key=\"bt_" k "\";label=\"" app-list "\";}" ":image {fixed_width=true;width=4;color=-2;key=\"im_" k "\";}")) (defun GrM_Setup_Dialog_Create ( / f ) (record "GrM_Setup_Dialog_Create") (if (and (setq setup-dialog-fn (vl-filename-mktemp "GrM.dcl")) (setq setup-dialog-fp (open setup-dialog-fn "w"))) (mapcar '(lambda (x)(write-line x setup-dialog-fp)) (list (strcat "GrM_Setup : dialog {label=\"GrM - Setup screen (Rlx " (now) ")\";") ":text_part {key=\"tp_debug_mode\";}" ":boxed_column {label=\"Dimensions\";" " :row {" " :column {" (dcl_plus_min "nof_rows" "Rows" "3") "spacer;"(dcl_plus_min "fill" "Fill (%)" "3") "}" " :column {" (dcl_plus_min "nof_columns" "Columns" "3") (dcl_plus_min "button_width_height_ratio" "Ratio W/H " "3") "}" " }" " :row {alignment=centered;" " :column {width=10;}" " :toggle {label=\"Use fixed cell width\";key=\"tg_use_fixed_width\";}" " :edit_box {edit_width=3;key=\"eb_fixed_width\";}" " :column {width=12;}" " :toggle {label=\"Use fixed cell height\";key=\"tg_use_fixed_height\";}" " :edit_box {edit_width=3;key=\"eb_fixed_height\";}" " :column {width=2;}" " }" "}" ":boxed_row {label=\"Colors\";" (dcl_button_image1 "frame_color" "Frame") (dcl_button_image1 "text_color" "Text") (dcl_button_image1 "background_color" "Background") "}" ":boxed_radio_row {label=\"Justification\";" " :radio_button {key=\"rb_left\";label=\"Left\";}" " :radio_button {key=\"rb_top\";label=\"Top\";}" " :radio_button {key=\"rb_center\";label=\"Center\";}" " :radio_button {key=\"rb_bottom\";label=\"Bottom\";}" " :radio_button {key=\"rb_right\";label=\"Right\";}" "}" "spacer;" ":boxed_column {" " :row {:edit_box {edit_width=3;label=\"Max Col\";key=\"eb_max_columns\";}" " :edit_box {edit_width=3;label=\"Max Row\";key=\"eb_max_rows\";}" " :edit_box {edit_width=3;label=\"Max Ratio\";key=\"eb_max_ratio\";}" " :edit_box {edit_width=3;label=\"Max Fill\";key=\"eb_max_fill\";}" " :edit_box {edit_width=3;label=\"Text size\";key=\"eb_text_size_factor\";}" " }" " spacer;spacer;" " :row {:toggle {label=\"Sort app-list on load\";key=\"tg_sort_on_load\";}" " :toggle {label=\"Follow Justification\";key=\"tg_follow_Justification\";}}" "}" "spacer;spacer;" ":column {:row {fixed_width=true;alignment=centered;" " :button{key=\"bt_app_list\";label=\"App list\";}" " :button{key=\"bt_preview\";label=\"Preview\";}" " :image_button {color=dialog_background;width=0.1;height=0.1;fixed_height=true;key=\"ib_debug_mode\";label=\"&d\";}" " ok_button;cancel_button;}}" "spacer;spacer;" "}" ) ) ) (if setup-dialog-fp (close setup-dialog-fp))(gc) ;(if (setq f (findfile setup-dialog-fn)) (startapp "notepad" f)(alert (strcat "huh? " (vl-princ-to-string f)))) ) (defun GrM_Setup_Dialog_Start ( / drv) (GrM_Setup_Dialog_Create) (if (and (setq setup-dialog-dcl (load_dialog setup-dialog-fn)) (new_dialog "GrM_Setup" setup-dialog-dcl)) (progn (GrM_Setup_Dialog_Update) (GrM_Setup_Dialog_Action) (setq drv (start_dialog)) (if setup-dialog-fn (vl-file-delete setup-dialog-fn)) (cond ((= drv 0)(Setup_Dialog_Cancel)) ((= drv 1)(WriteSettingsToRegistry)(GrM_Draw_Toolbar)) ((= drv 2)(WriteSettingsToRegistry)(Preview_Toolbar)) ) ) ) ) (defun Preview_Toolbar () (GrM_Draw_Toolbar) (princ "\rPress any key to return to dialog") (vl-catch-all-apply 'grread (list nil 8 0)) (redraw) (GrM_Setup_Dialog_Start) ) (defun cycle_Justification ( / co ol i) (setq co GrM-Toolbar-Justification ol '("left" "right" "top" "center" "bottom")) (if (setq i (vl-position co ol)) (progn (if (> i 3) (setq GrM-Toolbar-Justification (nth 0 ol)) (setq GrM-Toolbar-Justification (nth (1+ i) ol)) ) (GrM_Swappie)(WriteSettingsToRegistry)(GrM_Draw_Toolbar) ) ) ) (defun cycle_color ( / c cl i) ;;; grey1 (8), blue (144), green (72), red (12), pink (244), brown (24) (setq c GrM-Background-Color cl '("8" "144" "72" "12" "214" "24")) (if (setq i (vl-position c cl)) (progn (if (> i 4) (setq GrM-Background-Color (nth 0 cl)) (setq GrM-Background-Color (nth (1+ i) cl)) ) ) ;;; user can have selected color not in color list so start with list color numero uno (setq GrM-Background-Color (nth 0 cl)) ) (WriteSettingsToRegistry)(GrM_Draw_Toolbar) ) (defun GrM_Setup_Dialog_Update () (setq setup-dialog-tl '( (GrM-NoF-Rows "eb_nof_rows") (GrM-NoF-Columns "eb_nof_columns") (GrM-Button-Background-Fill "eb_fill") (GrM-Button-Width-Height-Ratio "eb_button_width_height_ratio") (GrM-Use-Fixed-Cell-Width "tg_use_fixed_width") (GrM-Use-Fixed-Cell-Height "tg_use_fixed_height") (GrM-Cell-Width "eb_fixed_width") (GrM-Cell-Height "eb_fixed_height") ;;; options (GrM-Max-Columns "eb_max_columns") (GrM-Max-Rows "eb_max_rows") (GrM-Max-Button-Width-Height-Ratio "eb_max_ratio") (GrM-Max-Button-Background-Fill "eb_max_fill") (GrM-Text-Size-Factor "eb_text_size_factor") (GrM-Follow-Justification "tg_follow_Justification") (GrM-Sort-On-Load "tg_sort_on_load") ;;; GrM-Max-Columns GrM-Max-Rows GrM-Follow-Justification GrM-Sort-On-Load GrM-Text-Size-Factor ) ) ;;; rd = reset data (val1 val2 ...) , in case of a cancel store original values before start of dialog (if (null setup-dialog-rd) (setq setup-dialog-rd (Save_Setup_Dialog_Data setup-dialog-tl))) ;;; set edit boxes and toggle values (Set_Setup_Dialog_Tiles setup-dialog-tl) ;;; update color images (Frame , Text & Background (GrM_Update_Color_Images) ;;; update radiobuttons (Justification top/left/bottom/right (GrM_Update_Radio_Buttons) ;;; Check & set debug mode (set_tile "tp_debug_mode" (if (and GrM-Debug-Mode (eq GrM-Debug-Mode "1")) " * debug mode *" "")) ) (defun GrM_Setup_Dialog_Action () (mapcar '(lambda (x)(action_tile (car x) (cadr x))) '(("cancel" "(done_dialog 0)") ("accept" "(done_dialog 1)") ("bt_preview" "(done_dialog 2)") ("ib_debug_mode" "(Toggle_Debug_Mode)") ("eb_nof_rows" "(setq GrM-NoF-Rows $value)") ;;; GrM_IncTile - just for testing ("bt_nof_rows_plus" "(GrM_IncTile $key 1)") ("bt_nof_rows_min" "(GrM_IncTile $key -1)") ("eb_nof_columns" "(setq GrM-NoF-Columns $value)") ("bt_nof_columns_plus" "(GrM_IncTile $key 1)") ("bt_nof_columns_min" "(GrM_IncTile $key -1)") ("eb_fill" "(setq GrM-Button-Background-Fill $value)") ("bt_fill_plus" "(GrM_IncTile $key 1)") ("bt_fill_min" "(GrM_IncTile $key -1)") ("eb_button_width_height_ratio" "(setq GrM-Button-Width-Height-Ratio $value)") ("bt_button_width_height_ratio_plus" "(GrM_IncTile $key 1)") ("bt_button_width_height_ratio_min" "(GrM_IncTile $key -1)") ;;; fixed width / height ("tg_use_fixed_width" "(setq GrM-Use-Fixed-Cell-Width $value)") ("tg_use_fixed_height" "(setq GrM-Use-Fixed-Cell-Height $value)") ("eb_fixed_width" "(setq GrM-Cell-Width $value)") ("eb_fixed_height" "(setq GrM-Cell-Height $value)") ;;; color handling ("bt_frame_color" "(get_frame_color)") ("bt_text_color" "(get_text_color)") ("bt_background_color" "(get_background_color)") ;;; options ("eb_max_columns" "(setq GrM-Max-Columns $value)") ("eb_max_rows" "(setq GrM-Max-Rows $value)") ("eb_text_size_factor" "(setq GrM-Text-Size-Factor $value)") ("tg_follow_Justification" "(setq GrM-Follow-Justification $value)") ("tg_sort_on_load" "(setq GrM-Sort-On-Load $value)") ;;; toolbar Justification / justification ("rb_left" "(GrM_Set_Justification $key)")("rb_right" "(GrM_Set_Justification $key)") ("rb_top" "(GrM_Set_Justification $key)")("rb_center" "(GrM_Set_Justification $key)") ("rb_bottom" "(GrM_Set_Justification $key)") ;;; ("bt_app_list" "(done_dialog 3)") (GrM_App_List_Dialog) ("bt_app_list" "(GrM_App_List_Dialog)") ) ) ) ;;; low tec but functional (defun Toggle_Debug_Mode () (cond ((eq GrM-Debug-Mode "1") (setq GrM-Debug-Mode "0")) ((eq GrM-Debug-Mode "0") (setq GrM-Debug-Mode "1")) (t (setq GrM-Debug-Mode "0"))) (set_tile "tp_debug_mode" (if (and GrM-Debug-Mode (eq GrM-Debug-Mode "1")) " * debug mode *" "")) ) (defun GrM_Update_Color_Images () (mapcar '(lambda (i c)(GrM_SetColorImage i c)) (list "im_frame_color" "im_text_color" "im_background_color") (list GrM-Frame-Color GrM-Text-Color GrM-Background-Color))) (defun GrM_Update_Radio_Buttons () (cond ((eq GrM-Toolbar-Justification "left")(set_tile "rb_left" "1")) ((eq GrM-Toolbar-Justification "right")(set_tile "rb_right" "1")) ((eq GrM-Toolbar-Justification "top")(set_tile "rb_top" "1")) ((eq GrM-Toolbar-Justification "bottom")(set_tile "rb_bottom" "1")) ((eq GrM-Toolbar-Justification "center")(set_tile "rb_center" "1")) ) ) ;;; when Justification changes from horizontal to vertical , swap nof columns & nof rows (defun GrM_Swappie ( / i1 i2) (setq i1 (atoi GrM-NoF-Columns) i2 (atoi GrM-NoF-Rows)) (cond ;;; horizontal ((member GrM-Toolbar-Justification '("top" "center" "bottom")) (setq GrM-NoF-Columns (itoa (max i1 i2)) GrM-NoF-Rows (itoa (min i1 i2)))) ;;; vertical ((member GrM-Toolbar-Justification '("left" "right" )) (setq GrM-NoF-Columns (itoa (min i1 i2)) GrM-NoF-Rows (itoa (max i1 i2)))) ) ) ;;; gonna assume that when Justification is left or right (vertical) , the number for rows is larger ;;; than the number for columns , this is handeld by setting GrM-Follow-Justification in dialog (defun GrM_Set_Justification (k) (setq GrM-Toolbar-Justification (substr k 4)) (if (eq GrM-Follow-Justification "1") (progn (GrM_Swappie)(set_tile "eb_nof_columns" GrM-NoF-Columns)(set_tile "eb_nof_rows" GrM-NoF-Rows)) ) ) ;;; for now fixed max number of rows / columns to 10 (i is not used anymore , uses tile name instead (defun GrM_IncTile ( tl i / v cmax rmax ratmax fmax) (if (isnum GrM-Max-Columns)(setq cmax (atoi GrM-Max-Columns))(setq cmax 12)) (if (isnum GrM-Max-Rows)(setq rmax (atoi GrM-Max-Rows))(setq rmax 12)) (if (isnum GrM-Max-Button-Width-Height-Ratio)(setq ratmax (atoi GrM-Max-Button-Width-Height-Ratio))(setq ratmax 3)) (if (isnum GrM-Max-Button-Background-Fill)(setq fmax (atoi GrM-Max-Button-Background-Fill))(setq fmax 100)) (cond ;;; columns ((eq tl "bt_nof_columns_plus") (setq GrM-NoF-Columns (itoa (1+ (atoi GrM-NoF-Columns)))) (if (> (atoi GrM-NoF-Columns) cmax) (setq GrM-NoF-Columns (itoa cmax))) (set_tile "eb_nof_columns" GrM-NoF-Columns)) ((eq tl "bt_nof_columns_min") (setq GrM-NoF-Columns (itoa (1- (atoi GrM-NoF-Columns)))) (if (< (atoi GrM-NoF-Columns) 1) (setq GrM-NoF-Columns "1")) (set_tile "eb_nof_columns" GrM-NoF-Columns)) ;;; rows ((eq tl "bt_nof_rows_plus") (setq GrM-NoF-Rows (itoa (1+ (atoi GrM-NoF-Rows)))) (if (> (atoi GrM-NoF-Rows) rmax) (setq GrM-NoF-Rows (itoa rmax))) (set_tile "eb_nof_rows" GrM-NoF-Rows)) ((eq tl "bt_nof_rows_min") (setq GrM-NoF-Rows (itoa (1- (atoi GrM-NoF-Rows)))) (if (< (atoi GrM-NoF-Rows) 1) (setq GrM-NoF-Rows "1")) (set_tile "eb_nof_rows" GrM-NoF-Rows)) ;;; width / height ratio ((eq tl "bt_button_width_height_ratio_plus") (setq GrM-Button-Width-Height-Ratio (itoa (1+ (atoi GrM-Button-Width-Height-Ratio)))) (if (> (atoi GrM-Button-Width-Height-Ratio) ratmax) (setq GrM-Button-Width-Height-Ratio (itoa ratmax))) (set_tile "eb_button_width_height_ratio" GrM-Button-Width-Height-Ratio)) ((eq tl "bt_button_width_height_ratio_min") (setq GrM-Button-Width-Height-Ratio (itoa (1- (atoi GrM-Button-Width-Height-Ratio)))) (if (< (atoi GrM-Button-Width-Height-Ratio) 1) (setq GrM-Button-Width-Height-Ratio "1")) (set_tile "eb_button_width_height_ratio" GrM-Button-Width-Height-Ratio)) ;;; button background fill ((eq tl "bt_fill_plus") (setq GrM-Button-Background-Fill (itoa (+ (atoi GrM-Button-Background-Fill) 10))) (if (> (atoi GrM-Button-Background-Fill) fmax) (setq GrM-Button-Background-Fill (itoa fmax))) (set_tile "eb_fill" GrM-Button-Background-Fill)) ((eq tl "bt_fill_min") (setq GrM-Button-Background-Fill (itoa (- (atoi GrM-Button-Background-Fill) 10))) (if (< (atoi GrM-Button-Background-Fill) 10) (setq GrM-Button-Background-Fill "10")) (set_tile "eb_fill" GrM-Button-Background-Fill)) ;;; overkill...really (t (alert (strcat "\nUnknown IncTile : " (vl-princ-to-string tl) " / " (vl-princ-to-string i)))) ) ) ;;; --- color handling -------------------------------------- color handling --------------------------------------- color handling --- ;;; (defun getcolor (d) (if (or (void d) (not (isnum d)))(setq d 7)) (acad_colordlg d nil)) ;;; check color , byblock/bylayer or nil are converted to color 7 (white) (defun checkcolor (c) (if (string-p c)(setq c (strcase c t))) (cond ((member c '(0 256 "0" "256" "byblock" "bylayer")) 7) ((numberp c) c) ((string-p c)(atoi c)) (t 7))) (defun GrM_SetColorImage (tilename color / col x y ) (if (isnum color) (cond ((= (type color) 'STR) (setq col (atoi color)))((= (type color) 'INT)(setq col color))(t (setq col 7)))) (if (and (string-p color) (member (strcase color T) '("bylayer" "byblock"))) (setq col 7)) (if col (progn (setq x (dimx_tile tilename) y (dimy_tile tilename)) (start_image tilename) (fill_image 0 0 x y col) (end_image))) ) (defun get_frame_color ( / c d ) (if (setq c (acad_colordlg (atoi GrM-Frame-Color) nil)) (progn (GrM_SetColorImage "im_frame_color" c)(setq GrM-Frame-Color (itoa c))))) (defun get_text_color ( / c d ) (if (setq c (acad_colordlg (atoi GrM-text-Color) nil)) (progn (GrM_SetColorImage "im_text_color" c)(setq GrM-text-Color (itoa c))))) (defun get_background_color ( / c d ) (if (setq c (acad_colordlg (atoi GrM-background-Color) nil)) (progn (GrM_SetColorImage "im_background_color" c)(setq GrM-background-Color (itoa c))))) ;;; --- dialog section ------------------------------------ end dialog section ------------------------------------- dialog section --- ;;; ;;; (re) calculate display parameters (dim_screen) ;;; screensize = (1840.0 685.0) (PC dependent / zoom independent) ;;; viewsize = height of current screen , varies with zoom ;;; viewctr = screen center point , varies with zoom ;;; recalculate after each zoom : dx dy / vx- vy- vx+ vy+ / vc vs ss dx dy vx- vy- vx+ vy+ vh vw) (defun dim_screen ( / dx dy) (setq vc (getvar "VIEWCTR") vs (getvar "VIEWSIZE") ss (getvar "SCREENSIZE")) ;;; view (half) width & view (half) height (assist for cornerpoints calculation) (setq dx (* vs (/ (car ss) (cadr ss)) 0.5) dy (* vs 0.5)) ;;; view corner points (setq vx- (- (car vc) dx) vy- (- (cadr vc) dy) vx+ (+ (car vc) dx) vy+ (+ (cadr vc) dy)) ;;; view height en view width (setq vh (- vy+ vy-) vw (- vx+ vx-)) ;;; inspect / debug ;(inspect (list 'vx- 'vy- 'vx+ 'vy+ 'vh 'vw 'vc)) ) ;;; cell width / height depends on viewsize / #rows / #colomns / Justification ;;; if Justification = horizontal then justification can be top / center / bottom ;;; if Justification = vertical then justification can be left / right ;;; - calculate cell width / cell height ;;; if Justification = horizontal : cell width = screen width / #cols , cell height = cell width / 2 ;;; if Justification = vertical ; cell height = screen height / #rows , cell width = cell height * 2 ;;; - calculate corner points , then start from center point ;;; replaces dim_cell with GrM_Draw_Toolbar which uses data from dialog / registry variables (defun GrM_Draw_Toolbar ( / tb-hw tb-hh) ;;; have no idea why sometimes GrM_Init is skipped , dirty fix (chk_reg_vars) ;;; get view data (dim_screen) ;;; first thing I need is cell height & cell width (if (member GrM-Toolbar-Justification '("top" "center" "bottom")) ;;; horizontal (progn (cond ;;; if use fixed cell width = true ;;; (X-to-N = anything to number , allow zero = 0 , fix numer = 0) ((= GrM-Use-Fixed-Cell-Width "1") (if (not (void GrM-Cell-Width)) (setq cell-width (X-to-N GrM-Cell-Width 0 0))(setq cell-width default-button-width))) ;;; divide screen-width by number of columns ((and (= GrM-Use-Fixed-Cell-Width "0") (setq i (X-to-N GrM-NoF-Columns 0 0))) (setq cell-width (/ vw i))) (t (setq cell-width (/ vw 10.0))) ) (cond ((eq GrM-Auto-Cell-Size-Ratio "1") (setq cell-Height (* cell-width 0.5))) ;;; if use fixed cell height = true ((= GrM-Use-Fixed-Cell-Height "1") (if (not (void GrM-Cell-Height)) (setq cell-height (X-to-N GrM-Cell-Height 0 0))(setq cell-height default-button-height))) (t (setq cell-height (* cell-width 0.5))) ) (setq tb-height (* cell-height (atoi GrM-NoF-Rows))) (cond ((eq GrM-Toolbar-Justification "top") (setq tb-x- vx- tb-y- (- vy+ tb-height) tb-x+ vx+ tb-y+ vy+)) ;;; tb-hw = toolbar half width , tb-hh = toolbar half height ((eq GrM-Toolbar-Justification "center") (setq tb-hw (* (atoi GrM-NoF-Columns) cell-width 0.5) tb-hh (* (atoi GrM-NoF-Rows) cell-height 0.5)) (setq tb-x- (- (car vc) tb-hw) tb-x+ (+ (car vc) tb-hw)) (setq tb-y- (- (cadr vc) tb-hh) tb-y+ (+ (cadr vc) tb-hh)) ) ((eq GrM-Toolbar-Justification "bottom") (setq tb-x- vx- tb-y- vy- tb-x+ vx+ tb-y+ (+ tb-y- tb-height))) ) ) ;;; "vertical" (progn ;;; calculate cell-height first (cond ;;;height is width / 2 ((and (eq GrM-Auto-Cell-Size-Ratio "1") (setq i (X-to-N GrM-NoF-Rows 0 0))) (setq cell-height (/ vh i))) ;;; if use fixed cell height = true (1 "1" T) check height (zero not allowed, dont fix result ((and (= GrM-Use-Fixed-Cell-Height "1") (setq i (X-to-N GrM-Cell-Height 0 0))) (setq cell-Height i)) ;;; divide screen-height by number of rows (zero not allowed , intergers only (fix result) ((and (= GrM-Use-Fixed-Cell-Height "0") (setq i (X-to-N GrM-NoF-Rows 0 0))) (setq cell-height (/ vh i))) ;;; set default for column of 10 rows (t (setq cell-height (/ vh 10.0))) ) ;;; calclate cell-width (cond ((eq GrM-Auto-Cell-Size-Ratio "1") (setq cell-width (* cell-height 2.0))) ;;; if use fixed cell width = true (1 "1" T) check width (zero not allowed, dont fix result ((and (= GrM-Use-Fixed-Cell-Width "1") (setq i (X-to-N GrM-Cell-Width 0 0))) (setq cell-width i)) (t (setq cell-width (* cell-height 2.0))) ) ;;; find toolbar alignment point ;;; for vertical these are left / center / right ;;; calculate width of toolbar for number of columns (setq tb-width (* cell-width (atoi GrM-NoF-Columns))) (cond ((eq GrM-Toolbar-Justification "left") (setq tb-x- vx- tb-y- vy- tb-x+ (+ tb-x- tb-width) tb-y+ vy+)) ((eq GrM-Toolbar-Justification "center") (setq tb-x- (- (car vc) (* tb-width 0.5)) tb-x+ (+ (car vc) (* tb-width 0.5)) tb-y- vy- tb-y+ vy+)) ((eq GrM-Toolbar-Justification "right") (setq tb-x- (- vx+ tb-width) tb-x+ vx+ tb-y- vy- tb-y+ vy+)) ) ) ) (if (eq GrM-Debug-Mode "1") (inspect (list 'vh 'vw 'GrM-Toolbar-Justification 'GrM-NoF-Columns 'GrM-NoF-Rows 'GrM-Use-Fixed-Cell-Height 'GrM-Cell-Height 'cell-Height 'GrM-Use-Fixed-Cell-Width 'GrM-Cell-Width 'cell-width 'GrM-Frame-Color 'GrM-Text-Color 'GrM-Background-Color ) ) ) (setq cell-text-height (/ cell-height 2.0)) ;(setq tst-cell-height cell-height tst-cell-width cell-width) ;;; some more testing (x- y- x+ y+ r c co / xl yl) (Draw_Frame tb-x- tb-y- tb-x+ tb-y+ (atoi GrM-NoF-Rows) (atoi GrM-NoF-Columns) 2) ) ;;; x-=xmin, x+=ymax etc, r=rows, c=columns, co=color ;;; (setq e- (getvar "EXTMIN") e+ (getvar "EXTMAX")) ;;; (Draw_Frame (car e-)(cadr e-)(car e+)(cadr e+) 5 5 1) (defun Draw_Frame (x- y- x+ y+ r c co / xl yl pl text-size bcol fcol tcol justy ) (record "Draw_Frame") (if (and (not (void GrM-background-Color))(isnum GrM-background-Color)) (setq bcol (atoi GrM-background-Color))(setq col 142)) (if (and (not (void GrM-Frame-Color))(isnum GrM-Frame-Color)) (setq fcol (atoi GrM-Frame-Color))(setq fcol 7)) (if (and (not (void GrM-Text-Color))(isnum GrM-Text-Color)) (setq tcol (atoi GrM-Text-Color))(setq tcol 7)) (redraw)(Fill_Toolbar_Background x- y- x+ y+ bcol) ;;; create x & y list for all grid coordinates (setq xl (gnl+ x- (1+ c) (/ (abs (- x+ x-)) c)) yl (gnl- y+ (1+ r) (/ (abs (- y+ y-)) r))) ;;; draw all horizontal lines (foreach y yl (grdraw (list x- y) (list x+ y) fcol)) ;;; draw all vertical lines (foreach x xl (grdraw (list x y+) (list x y-) fcol)) ;;; draw the texts (setq pl (gmpl xl yl)) ;;; cell-text-height is cell-height / 2 (if (and (not (void GrM-Text-Size-Factor))(isnum GrM-Text-Size-Factor)) (setq text-size (/ cell-text-height (atoi GrM-Text-Size-Factor))) (setq text-size (/ cell-text-height 9)) ) ;;; bad idea : grtxt routine has its limitations so I'll adjust text justification along with toolbar Justification ;;; all text insertion points are calculated based on middle algnment so lets keep it that way for now ;(cond ((eq GrM-Toolbar-Justification "left")(setq justy "L"))((eq GrM-Toolbar-Justification "right")(setq justy "R"))(t (setq justy "M"))) (setq justy "M") (mapcar '(lambda (p s) (grtxt (strcase s) p tcol 0 justy text-size)) pl (if (vl-consp app-list) (mapcar 'vl-filename-base app-list) '("Empty"))) (princ) ) ;;; fill toolbar background ;;; next y depends on zoom factor (viewsize) , 0.1 is emperical, bigger means bigger linespacing (defun Fill_Toolbar_Background (x- y- x+ y+ c / i vws) (setq i y- vws (getvar "viewsize")) (while (<= i y+)(grdraw (list x- i)(list x+ i) c)(setq i (+ i (* 0.1 (/ vws start-viewsize)))))) ;;; makes use of dialog variable (atoi GrM-Button-Background-Fill) 10-100 in steps of 10 (defun Fill_Toolbar_Background (x- y- x+ y+ c / i vws bgf-fac) (setq i y- vws (getvar "viewsize") bgf-fac (/ 0.1 (/ (atof GrM-Button-Background-Fill) 100.0))) (while (<= i y+)(grdraw (list x- i)(list x+ i) c)(setq i (+ i (* bgf-fac (/ vws start-viewsize)))))) ;;; (setq cel-id (GrM_GetCellNumber x y)) (defun GrM_GetCellNumber (x y / id ) ;;; cell number from dialog , without accouting for page number ;(setq id (+ (* (atoi GrM-NoF-Columns) (fix (/ y cell-height))) (fix (1+ (/ x cell-width))))) (if (eq tst-Justification "horizontal") (setq id (+ (* (atoi tst-NoF-Columns) (fix (/ y tst-cell-height))) (fix (1+ (/ x tst-cell-width))))) (setq id (+ (* (atoi tst-NoF-Rows) (fix (/ y tst-cell-height))) (fix (1+ (/ x tst-cell-width))))) ) ) ;;; (GrM_GetCell-ID (list 100.0 100.0) (list 130.0 70.0) 3 3 (list 122.0 79.0)) ;;; get cell-id from point selection to use as nth for app-list (defun GrM_GetCell-ID (ul lr c r p / dy dy x y)(setq x (car p) y (cadr p)) (setq dx (/ (abs (- (car lr) (car ul))) c) dy (/ (abs (- (cadr ul) (cadr lr))) r)) (+ (/ (fix (abs (- x (car ul))))(fix dx))(* (1- (- r (/ (fix (abs (- y (cadr lr))))(fix dy)))) c)) ) ;;; (show_grid) (defun show_grid ( / x dx y dy i) (setq x (fix screen-width) y (fix screen-height)) (setq dy (/ y (atoi GrM-NoF-Rows)) dx (/ x (atoi GrM-NoF-Columns))) (setq i 0)(while (< i x)(grdraw (list i 0) (list i y) 3)(setq i (fix (+ i dx)))) (setq i 0)(while (< i y)(grdraw (list 0 i) (list x i) 3)(setq i (fix (+ i dy))))) ;;; (setq corner (GrM_GetCellCorner 5)) (defun GrM_GetCellCorner ( cell / col row) (if (= (rem cell (atoi GrM-NoF-Columns)) 0) (setq col (atoi GrM-NoF-Columns) row (1- (/ cell (atoi GrM-NoF-Columns)))) (setq col (rem cell (atoi GrM-NoF-Columns)) row (/ cell (atoi GrM-NoF-Columns)))) (list (* cell-width (1- col)) (* cell-height row))) ;;; (Dim_Box (list 400 75) cell-width cell-height) ;;; arg top left point , width , height , return list cornerpoints (defun Dim_Box (p w h) (list p (polar p 0 w) (polar p (atan h w) (sqrt (+ (expt w 2)(expt h 2)))) (polar p (/ pi 2) h))) ;;; --- GrTxt ---------------------------------------------------- GrTxt ---------------------------------------------------- GrTxt --- ;;; ;;; found this old lisp (grtxt.lsp) , don't know author but all credits are for this human from earth ;;; text string / coordinate point / color / angle / justification/ z for text height ;;; *** UPPER CASE ONLY *** (grtxt (STRCASE "Rob") (getvar "viewctr") 1 0 "M") ;;; 2025-07-29 added z for text height as parameter (defun grtxt (ts cp cl a j z / vp ltb i xp c p1 p2 lp ld n al) ;;; vertex points (setq vp '(( 1 ( 0.50 0.25))( 2 ( 0.50 0.55))( 3 ( 0.50 0.85))( 4 ( 0.50 1.00))( 5 ( 0.25 1.00)) ( 6 ( 0.00 1.00))( 7 (-0.25 1.00))( 8 (-0.50 1.00))( 9 (-0.50 0.85))(10 (-0.50 0.55)) (11 (-0.50 0.25))(12 (-0.50 0.10))(13 (-0.25 0.10))(14 ( 0.00 0.10))(15 ( 0.25 0.10)) (16 ( 0.50 0.10))(17 ( 0.50 -0.05))(18 ( 0.50 -0.45))(19 ( 0.50 -0.85))(20 ( 0.50 -1.00)) (21 ( 0.25 -1.00))(22 ( 0.00 -1.00))(23 (-0.25 -1.00))(24 (-0.50 -1.00))(25 (-0.50 -0.85)) (26 (-0.50 -0.40))(27 (-0.50 -0.05))(30 ( 0.35 0.85))(31 (-0.35 0.85))(32 (-0.35 -0.85)) (33 ( 0.35 -0.85))(40 ( 0.25 0.35))(41 (-0.25 0.35))(42 ( 0.25 -0.15))(43 (-0.25 -0.15)) (44 ( 0.00 0.45))(45 ( 0.00 -0.25))(50 ( 0.30 0.20))(51 ( 0.30 0.35))(52 ( 0.20 0.35)) (53 ( 0.20 0.20))(54 ( 0.30 0.10))(55 ( 0.30 -0.10))(56 ( 0.20 -0.10))(57 ( 0.20 0.10)) (60 (-0.30 0.20))(61 (-0.30 0.35))(62 (-0.20 0.35))(63 (-0.20 0.20))(64 (-0.30 0.10)) (65 (-0.30 -0.10))(66 (-0.20 -0.10))(67 (-0.20 0.10)))) ;;; letter table (setq ltb '(("A" 24 9 7 5 3 20 16 12) ("B" 12 15 1 3 5 8 24 21 19 17 15) ("C" 3 5 7 9 25 23 21 19) ("D" 3 5 8 24 21 19 3) ("E" 4 8 12 15 12 24 20) ("F" 4 8 12 15 12 24) ("G" 3 5 7 9 25 23 21 19 16 14) ("H" 20 -4 8 -24 16 12) ("I" 7 5 6 22 23 21) ("J" 4 19 21 23 25) ("K" 8 24 12 13 4 13 20) ("L" 8 24 20) ("M" 24 8 14 4 20) ("N" 24 8 20 4) ("O" 3 5 7 9 25 23 21 19 3) ("P" 12 15 1 3 5 8 24) ("Q" 3 5 7 9 25 23 21 19 3 -19 20 45) ("R" 20 14 12 15 1 3 5 8 24) ("S" 3 5 7 9 11 13 15 17 19 21 23 25) ("T" 4 8 6 22) ("U" 8 25 23 21 19 4 20) ("V" 8 22 4) ("W" 8 23 14 21 4) ("X" 4 -24 8 20) ("Y" 8 14 22 14 4) ("Z" 8 4 24 20) ("0" 3 5 7 9 25 23 21 19 -3 4 24) ("1" 31 7 6 22 21 23) ("2" 9 7 5 3 1 15 13 27 24 20) ("3" 9 7 5 3 1 15 13 15 17 19 21 23 25) ("4" 8 12 16 15 5 21) ("5" 4 8 12 15 17 19 21 23 25) ("6" 3 5 7 9 25 23 21 19 17 15 12) ("7" 8 4 22) ("8" 3 5 7 9 11 13 27 25 23 21 19 17 15 13 15 1 3) ("9" 25 23 21 19 3 5 7 9 11 13 16) ("<" 4 12 20) (">" 8 16 24) ("," 33 21) ("." 19 20 21 33 19) ("\'" 4 30) ("\"" 4 -30 7 31) (";" 50 51 52 53 -50 54 55 56 57 55 45) (":" 50 51 52 53 -50 54 55 56 57 55) ("\\" 8 20) ("/" 4 24) ("?" 11 10 7 5 2 1 45 22) ("|" 6 -44 45 22) ("+" 44 -45 13 15) ("=" 40 -41 43 42) ("-" 13 15) ("_" 20 24) (")" 6 2 18 22) ("(" 6 10 26 22) ("*" 40 -43 41 -42 45 44) ("&" 21 31 7 6 26 25 23 16) ("^" 10 6 2) ("%" 57 54 55 56 -57 63 60 61 62 -63 5 24) ("$" 3 5 7 9 11 13 15 17 19 21 23 25 -26 22 6) ("#" 24 -6 22 -4 1 -11 17 27) ("@" 42 15 40 44 41 13 43 45 42 17 3 5 7 9 25 23 21 19) ("!" 6 -45 22 22) ("~" 9 31 44 40 2) ("`" 8 31) ("[" 6 8 24 22) ("]" 6 4 20 22) ("{" 6 7 41 12 43 23 22) ("}" 6 5 40 16 42 21 22) (""))) ;;; text height - use z as parameter ;;;(setq z (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE")) 0.1)) ;;;(setq z (/ (getvar "VIEWSIZE") 10)) (cond ;;; left justification ((eq (strcase (substr j 1 1)) "L") (setq xp (list (+ (car cp) z) (cadr cp)) i 1)) ;;; middle justification ((eq (strcase (substr j 1 1)) "M") (setq xp (list (- (car cp) (* z (strlen ts) 0.5)) (cadr cp)) i 1)) ;;; right justification ((eq (strcase (substr j 1 1)) "R") (setq xp (list (- (car cp) (* z (strlen ts) 1.5)) (cadr cp)) i 1)) ) (repeat (strlen ts) ;;; each charachter / line point list / letter point def (setq c (substr ts i 1) lp '() ld (cdr (assoc c ltb))) (while (> (length ld) 1) (setq p1 (cadr (assoc (abs (nth 0 ld)) vp)) p2 (cadr (assoc (abs (nth 1 ld)) vp)) p1 (mapcar '* (list z z) p1) p2 (mapcar '* (list z z) p2) p1 (mapcar '+ xp p1) p2 (mapcar '+ xp p2) lp (append lp (list (if (minusp (nth 0 ld)) 0 cl) p1 p2)) ld (cdr ld)) ) ;;; add rotation angle (setq n 0 al nil) (repeat (/ (length lp) 3) (setq al (cons (nth n lp) al) al (cons (polar cp (+ a (angle cp (nth (+ n 1) lp))) (distance cp (nth (+ n 1) lp))) al) al (cons (polar cp (+ a (angle cp (nth (+ n 2) lp))) (distance cp (nth (+ n 2) lp))) al)) (setq n (+ n 3)) ) (and al (grvecs (reverse al))) (setq xp (list (+ (car xp) (* z 1.5)) (cadr xp)) i (1+ i)) ) (prin1) ) ;;; --- GrTxt ---------------------------------------------------- GrTxt ---------------------------------------------------- GrTxt --- ;;; ;;; --- App list dialog ------------------------------------- App list dialog ------------------------------------- App list dialog --- ;;; ;;; Simple File Dialog ;;; f = dialog file name , p = pointer , d = dialog , app-list = list , i = input , idx = listbox index (defun GrM_App_List_Dialog ( / f p d app-list i idx regkey regvar Filli-Dat-File return-to-setup-dialog) (setq idx 0) ;;; (InitDefaultRegistrySettings)(ReadSettingsFromRegistry) ;;; first use (if (or (null GrM-App-List-File)(not (eq (type GrM-App-List-File) 'STR))) (progn (setq GrM-App-List-File (vl-filename-mktemp "app-list.dat") p (open GrM-App-List-File "w")) (close p)(gc) ) ) ;;; read data file (if (and (findfile GrM-App-List-File)(setq p (open GrM-App-List-File "r"))) (progn (while (setq i (read-line p))(setq app-list (cons i app-list)))(close p))) ;;; check data list (if (vl-consp app-list)(setq app-list (acad_strlsort app-list)) (setq app-list (list "Empty"))) ;;; create dialog (if (and (setq f (vl-filename-mktemp "filli.dcl") p (open f "w"))) (mapcar '(lambda (x)(write-line x p)) (list (strcat "app_list : dialog {label=\"App list dialog (Rlx " (now) ")\";") "spacer;:text_part {key=\"tp\";}spacer;" ":boxed_row {label=\"File list\";:column {:list_box {key=\"lb\";width=64;}}spacer;" ":column {:button {key=\"add\";label=\"Add\";}:button {key=\"del\";label=\"Del\";}" ":button {key=\"up\";label=\"Up\";}:button {key=\"down\";label=\"Down\";}:button {key=\"sort\";label=\"Sort\";}}}" ":text_part {key=\"tp_file_info\";}" "spacer; :column {:row {fixed_width=true;alignment=centered;:button{key=\"load\";label=\"Load\";}" ":button{key=\"save\";label=\"Save\";}:button{key=\"saveas\";label=\"Saveas\";}" ":button{key=\"edit\";label=\"Edit\";} ok_button;cancel_button;}}spacer;spacer;}" ) ) (princ "\nComputer says no : unable to create dialog") ) ;;; clean desk policy (if p (progn (close p)(gc))) ;;; start dialog (if (and (setq d (load_dialog f)) (new_dialog "app_list" d)) (progn ;;; fill list box (setq idx 0)(lb_upd) ;;; activate buttons (action_tile "cancel" "(done_dialog 0)")(action_tile "accept" "(done_dialog 1)") (action_tile "lb" "(setq idx (atoi $value))(lb_upd_info)") (mapcar '(lambda (x)(action_tile x "(action_key $key)")) '("add" "del" "up" "down" "sort" "load" "save" "saveas" "edit")) (setq drv (start_dialog)) (if (and f (setq f (findfile f))) (vl-file-delete f)) (cond ((= drv 0)) ((= drv 1)(WriteSettingsToRegistry)) ) ) ) ) ;;; just to have a little less code in main loop (defun action_key (k) (cond ((= k "add")(_add))((= k "del")(_del))((= k "up")(lb_mod "up"))((= k "down")(lb_mod "down")) ((= k "sort")(lb_sort))((= k "load")(_load))((= k "save")(_save))((= k "saveas")(_saveas)) ((= k "edit")(_edit_dat_file)) ) ) ;;; lb_upd = update list box (init / redraw / refresh) (defun lb_upd () (set_tile "tp" (strcat " Data file : " (vl-princ-to-string GrM-App-List-File))) (start_list "lb")(mapcar 'add_list (mapcar 'vl-filename-base app-list))(end_list) (set_tile "lb" (itoa idx)) (lb_upd_info) ) ;;; update the text part below listbox to show complete path & filename (defun lb_upd_info () (if (vl-consp app-list) (set_tile "tp_file_info" (strcat " File : " (vl-princ-to-string (nth idx app-list)))) (set_tile "tp_file_info" " File : - ") ) ) ;;; lb_sort = sort list box (defun lb_sort () (setq app-list (acad_strlsort app-list)) (start_list "lb")(mapcar 'add_list app-list)(end_list)(set_tile "lb" (itoa idx))) ;;; lb_mod = modify list box ;;; m = mode up or down ("u" or "d") , app-list = app list (global) , xl = temp list (local) ;;; idx = index (global) , i = index (local) , i1 / i2 = scrap lists (local) (defun lb_mod (m / i xl i1 i2) (setq i idx xl (vl-remove-if '(lambda (x)(= x "")) app-list)) (cond ((void i))((or (null xl)(< (length xl) 2)))((and (= i 0) (= m "up")))((and (>= i (1- (length xl)))(= m "down"))) (t (setq i1 (nth i xl)) (if (= m "up") (setq i (1- i) i2 (nth i xl)) (setq i (1+ i) i2 (nth i xl) )) (setq xl (subst "i1" i1 xl) xl (subst "i2" i2 xl) xl (subst i2 "i1" xl) xl (subst i1 "i2" xl) idx i))) (cond ((< idx 0)(setq idx 0)) ((>= idx (length xl))(setq idx (1- (length xl))))) (setq app-list xl) (lb_upd) ) ;;; --- Tiny lisp section --------------------------------- Tiny lisp section ----------------------------------- Tiny lisp section --- ;;; (defun void (x) (or (eq x nil)(and (listp x)(not (vl-consp x)))(and (eq 'STR (type x))(eq "" (vl-string-trim " \t\r\n" x))))) (defun isnum (n)(if (or (numberp n) (and (= (type n) 'STR) (distof n))) t nil)) (defun string-p (s) (if (= (type s) 'str) t nil)) (defun uc (s) (alert (strcat "Under construction : " s))) (defun now ( / s l ) (setq s (rtos (getvar "CDATE")) l '("Jan""Feb""Mar""Apr""May""Jun""Jul""Aug""Sep""Oct""Nov""Dec")) (strcat (substr s 7 2) "-" (nth (1- (atoi (substr s 5 2))) l) "-'" (substr s 3 2))) ;;; remove from list (defun rfl (e app-list) (apply 'append (subst nil (list e) (mapcar 'list app-list)))) ;;; anything to number : n = number in any format (INT/REAL/STR) , z = allow 0 (zero) , f = fix result ;;; (X-to-N "0.0" 0 0) = nil , (X-to-N "0.0" 1 0) = 0.0 , (X-to-N "0.0" 1 1) = 0 , (X-to-N "rlx" 1 1) = nil (defun X-to-N (n z f / r ) (cond ((eq (type n) 'INT )(setq r n))((eq (type n) 'REAL)(setq r n))((distof n)(setq r (distof n)))(t (setq r nil))) (cond ((not r))((and (zerop r) (member z '(0 "0" nil)))(setq r nil)))(cond ((not r) nil)((member f '(1 "1" T))(fix r))(t (float r)))) ;;; for debugging , sort of trace list (defun record (s)(setq rec-list (cons s rec-list))) ;;; (setq rec-list nil) ;;; (setq a 1 b nil) (inspect (list 'a 'b)) (defun inspect (lst / _f) (defun _f (l) (apply 'strcat (cdr (apply 'append (mapcar (function (lambda (x) (list "\n" x))) l))))) (alert (_f (mapcar '(lambda (x) (strcat (vl-symbol-name x) " = " (vl-princ-to-string (vl-symbol-value x)))) lst)))) ;; tiny lisps ;;; generate number (gnum 1 5) -> '(1 2 3 4 5) (defun gnum (s e / i l) (and (numberp s)(numberp e)(setq i s)(while (<= i e)(setq l (cons i l) i (1+ i)))) (reverse l)) ;;; i = startnumber n = number of numbers , d = difference (gnl- 100 6 12) -> (100 88 76 64 52 40) ;;; generate all x-coordinates between xmin=322.5 & xmax =347.5 , 5 columns ;;; (gnl- xmax col+1 (- xmax xmin)) ;;; (gnl- 347.5 (1+ 5) (/ (- 347.5 322.5) 5)) -> (347.5 342.5 337.5 332.5 327.5 322.5) (defun gnl- (i n d / l)(setq l (list i))(repeat (1- n)(setq l (cons (setq i (- i d)) l)))(reverse l)) ;;; same but incremental ;;; (gnl- xmin (1+ col) (- xmax xmin)) (gnl- -10 6 (- -10 10)) ;;; (gnl+ 322.5 (1+ 5) (/ (- 347.5 322.5) 5)) -> (322.5 327.5 332.5 337.5 342.5 347.5) (defun gnl+ (i n d / l)(setq l (list i))(repeat (1- n)(setq l (cons (setq i (+ i d)) l)))(reverse l)) ;;; generate midpoint list ;;; (gmpl '(10 20 30 40 ) '(100 90 80)) -> '((15 95) (25 95) (35 95) (15 85) (25 85) (35 85)) (defun gmpl (xl yl / f x y) (defun f (l)(mapcar '(lambda (a b) (+ a (/ (- b a) 2.0))) l (cdr l))) (setq x (f '(10 20 30 40))) ;;; -> '(15.0 25.0 35.0) (setq y (f '(100 90 80))) ;;; -> '(95.0 85.0) (mapcar '(lambda (yy) (mapcar '(lambda (xx)(cons xx yy)) (f '(10 20 30 40)))) (f '(100 90 80))) ;;; -> (((15.0 . 95.0) (25.0 . 95.0) (35.0 . 95.0)) ((15.0 . 85.0) (25.0 . 85.0) (35.0 . 85.0))) ) ;;; (gmpl '(10 20 30 40 ) '(100 90 80)) (defun gmpl (xl yl / f) (defun f (l)(mapcar '(lambda (a b)(+ a (/ (- (float b) (float a)) 2.0))) l (cdr l))) (apply 'append (mapcar '(lambda (y)(mapcar '(lambda (x)(list x y 0.0))(f xl)))(f yl)))) ;;; rlx_sf - sub folders : c:/temp/test -> ("c:" "temp" "test") (defun rlx_sf ( fol / i) (if (setq i (vl-string-search "\\" fol)) (cons (substr fol 1 i) (rlx_sf (substr fol (+ i 1 (strlen "\\"))))) (list fol))) ;;; rlx_mf - make folder (defun rlx_mf ( fol / sf) (defun MF (rt sf) (if sf ((lambda (fol)(vl-mkdir fol)(MF fol (cdr sf)))(strcat rt "\\" (car sf))))) (if (setq sf (rlx_sf (vl-string-translate "/" "\\" fol))) (MF (car sf) (cdr sf))) (vl-file-directory-p fol)) ;;; --- Tiny lisp section --------------------------------- Tiny lisp section ----------------------------------- Tiny lisp section --- ;;; ;;; --- File operations ------------------------------------ File operations -------------------------------------- File operations --- ;;; ;;; load / save (data) file ;;; app-list = global list for list box , app-list is global name for data file (defun _load ( / fn fp i lst def) (if (or (void GrM-App-List-File) (not (setq def (car (fnsplitl GrM-App-List-File)))) (not (vl-file-directory-p def)))(setq def "")) (if (and (setq fn (getfiled "Select a data file" def "dat" 0))(setq fp (open fn "r"))) (while (setq i (read-line fp))(setq lst (cons i lst)))) (if fp (close fp)) (if (vl-consp lst) (progn (if (and (> (length lst) 1)(member "Empty" lst)) (setq lst (vl-remove "Empty" lst))) (setq GrM-App-List-File fn) (if (eq GrM-Sort-On-Load "1") (setq app-list (acad_strlsort lst)) (setq app-list (reverse lst)) ) (lb_upd) (WriteSettingsToRegistry) ) ) ) ;;; (create_default_data_file "c:\\temp\\rlx\\rlx\\xxx.xxx") (defun create_default_data_file ( fn / split) (cond ((or (null fn) (not (eq (type fn) 'STR)) (eq fn "")) (alert (strcat "unable to create file : " (vl-princ-to-string fn)))) ((findfile fn)) (t (setq split (fnsplitl fn)) (if (not (vl-file-directory-p (car split))) (rlx_mf (car split))) (if (setq fp (open fn "w")) (progn (close fp)(gc)) (alert (strcat "unable to create file : " (vl-princ-to-string fn))) ) ) ) ) (defun GrM_Preload_App_List ( / fn fp lst) (if (and (not (void (setq fn GrM-App-List-File)))(findfile fn)(setq fp (open fn "r"))) (while (setq i (read-line fp))(setq lst (cons i lst)))) (if fp (close fp)) ;(if (vl-consp lst)(setq app-list lst)(setq app-list '("Empty"))) (if (vl-consp lst)(setq app-list (reverse lst))(setq app-list '("Empty"))) ) (defun _save ( / fn fp def ) (if (and (not (void (setq fn GrM-App-List-File)))(findfile fn)(vl-consp app-list)(setq fp (open fn "w"))) (progn ;;; remove "Empty" from list if items have been added (if (and (> (length app-list) 1)(member "Empty" app-list)) (setq app-list (vl-remove "Empty" app-list))) (foreach x app-list (write-line x fp)) (close fp) (gc) ) ) ) (defun _saveas ( / fn fp def ) (if (or (void GrM-App-List-File) (not (setq def (car (fnsplitl GrM-App-List-File)))) (not (vl-file-directory-p def)))(setq def "")) (if (and (vl-consp app-list)(setq fn (getfiled "Select a data file" def "dat" 1))(setq fp (open fn "w"))) (progn (foreach x app-list (write-line x fp))(close fp)(gc) (setq GrM-App-List-File fn)(WriteSettingsToRegistry) ) ) ) ;;; add / del to / from list ;;; update : add full path instead of filename only (defun _add ( / f d e) (setq e "lsp") (if (or (void GrM-App-List-File)(not (setq d (car (fnsplitl GrM-App-List-File))))(not (vl-file-directory-p d)))(setq d "")) (if (setq f (getfiled "Select a lisp file" d e 0)) (progn (if (or (not (vl-consp app-list)) (equal app-list (list "Empty"))) (setq app-list (list f)) (setq app-list (append app-list (list f))) ) (lb_upd) ) ) ) (defun _del () (setq app-list (rfl (nth idx app-list) app-list)) (lb_upd)) (defun _edit_dat_file ( / fn) (if (and (not (void (setq fn GrM-App-List-File)))(findfile fn)) (progn (done_dialog) (startapp "notepad" fn)(alert "Press ok when done")(GrM_App_List_Dialog)))) ;;; --- File operations ------------------------------------ File operations -------------------------------------- File operations --- ;;; (defun GrM_Start_GrRead ( / done inp) (setq done nil) (while (not done) (princ "\rSelect button or [B]ackground color,[CcRr] (+/- col/row),[J]ustification,[S]etup,[Z]oom (E/+/-),[Q]uit (Space/Enter/Esc/RM) :") (setq inp (vl-catch-all-apply 'grread (list nil 8 0))) (cond ((vl-catch-all-error-p inp)(setq done T)) ;;; point selection ((= (car inp) 3) (setq pt (cadr inp)) (setq id (GrM_GetCell-ID (list tb-x- tb-y+) (list tb-x+ tb-y-) (atoi GrM-NoF-Columns) (atoi GrM-NoF-Rows) pt)) (setq app (nth id app-list) done T)) ;;; nah, just for fun...o key cycles Justification ((or (equal inp '(2 106))(equal inp '(2 74)))(cycle_Justification)) ;;; also lots of fun...B key cycles background color ((or (equal inp '(2 66))(equal inp '(2 98)))(cycle_color)) ;;; s or S (setup) ((or (equal inp '(2 115))(equal inp '(2 83)))(GrM_Setup_Dialog_Start)) ; user pressed E of e ((member inp '((2 69)(2 101))) (command "zoom" "e")(GrM_Draw_Toolbar)) ; user pressed + ((equal inp '(2 43)) (vl-cmdf "zoom" "2x")(GrM_Draw_Toolbar)) ; user pressed - ((equal inp '(2 45)) (vl-cmdf "zoom" ".5x")(GrM_Draw_Toolbar)) ; user pressed z or Z ((member inp '((2 122)(2 90))) (vl-cmdf "'zoom" "")(GrM_Draw_Toolbar)) ;;; Enter Space or q/Q key or R-mouse button ((or (equal inp '(2 13)) (equal inp '(2 32)) (equal inp '(2 113)) (equal inp '(2 81)) (equal (car inp) 25)) (setq done T)) ; user pressed D of d - Toggle Debug Mode ((member inp '((2 68)(2 100)))(Toggle_Debug_Mode)) ;;; c (column) smaller (2 99) (GrM_IncTile "bt_nof_columns_min" 0) ((equal inp '(2 99)) (GrM_IncTile "bt_nof_columns_min" 0)(GrM_Draw_Toolbar)) ;;; K (Kolom = column) bigger (2 67) (GrM_IncTile "bt_nof_columns_plus" 0) ((equal inp '(2 67)) (GrM_IncTile "bt_nof_columns_plus" 0)(GrM_Draw_Toolbar)) ;;; r (row) smaller (2 114) (GrM_IncTile "bt_nof_rows_min" 0) ((equal inp '(2 114)) (GrM_IncTile "bt_nof_rows_min" 0)(GrM_Draw_Toolbar)) ;;; R (row) bigger (2 82) (GrM_IncTile "bt_nof_rows_plus" 0) ((equal inp '(2 82)) (GrM_IncTile "bt_nof_rows_plus" 0)(GrM_Draw_Toolbar)) ) ) (redraw) ) ;;; program assumes no self starting routines and start command is "C:" + app name (defun GrM_Start_App (app / fn) (cond ((setq fn (findfile app)) (redraw)(load fn)(eval (read (strcat "(C:" (vl-filename-base app) ")")))) (t (redraw)(princ (strcat "\nUnable to load " (vl-princ-to-string app) " ...bye"))) ) (princ) ) (vl-load-com) (princ "\nGrM - Graphic Menu - Rlx - last update 2025/09/10 (added rlx_sf)") (princ) ;;; (c:GrMs) ;;; Setup Dialog ;;; (C:GrM) ;;; Display Toolbar
-
Hi @rlx Is it possible that you forgot to include some functions that are called from your code? For example, 'rlx_sf'?
-
Function to calculate Mtext Justification based on Rotation
GLAVCVS replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
Hi I'm having trouble reconciling my understanding of your question with what I see in the example drawing. The square: doesn't it also play a role in determining the text justification? That is to say: if you select the upper right corner of the square and then specify a horizontal angle to the left, the justification should be bottom right. However, if you do the same thing starting from the lower right corner of the square, the MTEXT justification should be top right. Therefore, the idea seems to be that the MTEXT should always be positioned outside the square. Is this correct? In this case, the MTEXT angle criterion alone is not sufficient; it's also necessary to consider the object to which it refers. If all of this is correct, we would need to write a function that analyzes the geometry of the object the MTEXT refers to and determines the justification, taking the angle into account as well. -
Function to calculate Mtext Justification based on Rotation
BlackBox replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
Sorry to hear that; I didn't know. Agree it's better to test if you have the data needed before entmake* functions. If you're wanting to get CAD back, consider joining AUGI as Pro members get a free ADN (Autodesk Developer Network) membership, which would give you any Autodesk product to use for development. https://www.augi.com/adn-membership-offer Cheers