Here is VDO show how we can prompt to create rendering image by using Ai in PTCAD
Thursday, September 24, 2026
Wednesday, March 11, 2026
FREE LISP : Improving Drawing Quality by using Ortho-Check LISP
Improving Drawing Quality with an Ortho-Check LISP Tool
In many CAD workflows, especially in architectural, engineering, and construction drawings, maintaining orthogonal geometry (lines that are perfectly horizontal or vertical) is essential. However, during the drafting process, it is very common for small inaccuracies to occur. These errors may be almost invisible on screen but can create serious issues later in design coordination, quantity calculations, and model conversions.
An AutoLISP Ortho-Check tool helps solve this problem by automatically detecting and highlighting lines or polyline segments that are not aligned with the X or Y axis.
Common Problems in CAD Drawings
Even experienced CAD users frequently encounter situations where geometry is slightly misaligned. Some typical causes include:
1. Accidental Ortho Off
When the Ortho mode is turned off during drafting, lines may be drawn at a small angle unintentionally.
2. Snap or Input Precision Issues
Manual coordinate input or object snaps may produce tiny deviations, resulting in lines that appear straight but are actually rotated by a small angle.
3. Imported or Converted Drawings
Drawings imported from other software or converted from formats such as PDF, BIM models, or GIS data often contain geometry that is not perfectly orthogonal.
4. Editing Existing Geometry
Stretching, trimming, or modifying existing elements may introduce small angle deviations.
5. Polyline Segment Errors
Polylines can contain segments that are slightly rotated even when most of the shape is orthogonal.
These issues are often difficult to detect manually, especially in large drawings containing hundreds or thousands of objects.
Risks of Non-Orthogonal Geometry
Small angular errors can cause several downstream problems, including:
-
Dimension inaccuracies
-
Incorrect area or quantity calculations
-
Problems when generating BIM models
-
Difficulty when aligning walls, grids, or structural elements
-
Errors during CNC or fabrication workflows
-
Poor drawing standards and quality control issues
Because of these risks, many organizations implement drawing quality control (QC) procedures before issuing drawings.
How the AutoLISP Ortho-Check Tool Helps
The Ortho-Check AutoLISP tool automates the detection process by performing the following steps:
-
The user selects lines and polylines in the drawing.
-
The program analyzes each segment of the geometry.
-
It compares the X and Y coordinates of endpoints using a tolerance value.
-
Any segment that is not horizontal or vertical is identified.
-
The object is automatically highlighted for easy review.
-
A summary dialog reports the number of checked objects and detected errors.
This process allows users to quickly locate problematic geometry that would otherwise be very difficult to find manually.
Key Benefits
1. Faster Quality Control
Instead of visually inspecting drawings, the tool checks hundreds or thousands of objects in seconds.
2. Improved Drawing Accuracy
It ensures that geometry strictly follows orthogonal design standards.
3. Reduced Risk of Downstream Errors
By identifying geometry issues early, the tool prevents problems in modeling, documentation, and construction.
4. Works with Large Drawings
The AutoLISP solution is lightweight and performs efficiently even with very large datasets.
5. Supports Lines and Polylines
The tool checks both simple lines and complex polyline segments, which are common in architectural and engineering drawings.
6. Easy Integration into QC Workflow
Because the tool runs directly inside AutoCAD, it can easily become part of a standard drawing review procedure.
Practical Use Cases
This tool is particularly useful for:
-
Architectural floor plans
-
Structural grid layouts
-
Infrastructure drawings
-
Shop drawings
-
CAD files converted from BIM models
-
Drawings received from external consultants
In these scenarios, ensuring that geometry is truly orthogonal can significantly improve drawing quality and coordination.
Conclusion
Small geometric inaccuracies are common in CAD drawings, but they can lead to significant problems if left unchecked. An AutoLISP-based Ortho-Check tool provides a simple yet powerful way to automatically detect and highlight non-orthogonal lines and polyline segments.
By incorporating this tool into the drawing review process, CAD teams can improve quality control, reduce errors, and ensure cleaner, more reliable drawings before they are issued for construction or further design development.
Source code
Wednesday, February 25, 2026
FREE LISP : Draw curved stairs with numbering
LISP for Architects: Automatically Generating Curved Stairs from an Arc
In architectural drafting, stairs are one of the most common yet repetitive elements to draw. When designing curved stairs, the process can become time-consuming because each step must be carefully distributed along a curved path while maintaining consistent spacing and alignment.
Using LISP, architects and CAD technicians can automate this process and significantly reduce drafting time. This article introduces a simple yet powerful concept: automatically generating a curved stair layout from a selected arc.
The Problem with Manual Drafting
When creating a curved stair manually in PTCAD, the typical workflow involves:
-
Drawing the center arc of the staircase.
-
Calculating the angle division for each step.
-
Drawing radial lines for each riser.
-
Adding inner and outer boundaries.
-
Labeling the steps.
For a staircase with 15–20 steps, this can easily take several minutes. In large projects where multiple stairs exist, the time spent becomes significant. In addition, manual work increases the risk of errors such as:
-
Uneven step spacing
-
Incorrect stair width
-
Misaligned riser lines
-
Inconsistent geometry
The LISP Solution
A custom LISP routine can automate the entire process. With a single command, the user simply:
-
Selects an Arc representing the stair direction.
-
Inputs the number of steps.
-
Specifies the inner and outer radius of the stair.
The script then automatically:
-
Divides the arc into equal angular segments
-
Draws riser lines between the inner and outer radius
-
Generates the stair layout instantly
This transforms a multi-step manual process into a few seconds of automated drafting.
How the Algorithm Works
The logic behind the LISP routine is straightforward:
-
Read the arc geometry:
-
Center point
-
Start angle
-
End angle
-
-
Calculate the total arc angle:
-
Divide the arc angle by the number of steps:
-
Generate radial lines using polar coordinates from the arc center.
Each step is positioned by incrementally adding the step angle and projecting points using the polar function.
Example Workflow
An architect designing a curved staircase might follow this process:
-
Draw the stair center arc.
-
Run the command:
ARCSTAIR
-
Select the arc.
-
Enter the number of steps (e.g., 12).
-
Input the inner and outer radii.
Within seconds, the stair layout is generated automatically.
Benefits for Architectural Practice
Using LISP for curved stair generation offers several advantages:
1. Speed
Tasks that normally take several minutes can be completed in seconds.
2. Accuracy
Steps are mathematically distributed along the arc, eliminating spacing errors.
3. Consistency
Every staircase in a project follows the same geometric logic.
4. Productivity
Architects and drafters can focus more on design rather than repetitive drafting work.
Typical Stair Design Considerations
When applying this automation tool, architects should still follow common stair design guidelines:
| Parameter | Typical Range |
|---|---|
| Riser Height | 150–180 mm |
| Tread Depth | 250–300 mm |
| Stair Width | 900–1500 mm |
The LISP routine simply assists in drafting the geometry; the designer still controls the parameters.
Expanding the Tool
This basic curved stair generator can be extended further to include:
-
Automatic step numbering
-
Stair UP/DOWN arrows
-
Stair width control
-
Automatic dimension placement
-
Generation of 3D stair geometry
-
Automatic stair schedule export
With these enhancements, LISP can evolve from a simple drafting aid into a powerful architectural productivity tool.
Conclusion
Curved staircases are visually elegant but can be tedious to draft manually. By leveraging LISP automation, architects can transform a repetitive process into a fast and reliable workflow.
A simple script that generates stairs from an arc demonstrates how small automation tools can dramatically improve efficiency in architectural drafting. For firms that frequently work with complex geometry, investing in custom LISP tools can lead to significant gains in both productivity and drawing quality.
Source code
r1 r2 tread i a p1 p2 mid txtpt)
(prompt "\nSelect ARC for stair centerline: ")
(setq ent (car (entsel)))
(setq ed (entget ent))
(if (= (cdr (assoc 0 ed)) "ARC")
(progn
(setq cen (cdr (assoc 10 ed)))
(setq rad (cdr (assoc 40 ed)))
(setq ang1 (cdr (assoc 50 ed)))
(setq ang2 (cdr (assoc 51 ed)))
(setq step (getint "\nEnter number of steps: "))
(setq r1 (getreal "\nInner radius: "))
(setq r2 (getreal "\nOuter radius: "))
(setq ang (/ (- ang2 ang1) step))
(prompt "\nCreating stairs...")
(setq i 0)
(while (<= i step)
(setq a (+ ang1 (* ang i)))
(setq p1 (polar cen a r1))
(setq p2 (polar cen a r2))
(command "LINE" p1 p2 "")
(setq i (+ i 1))
)
(setq i 0)
(while (< i step)
(setq a (+ ang1 (* ang (+ i 0.5))))
(setq mid (polar cen a (/ (+ r1 r2) 2)))
(setq txtpt mid)
(PRINC (ITOA i))
(setq txh (* r1 0.03))
(command "TEXT" txtpt txh 0 (itoa (+ i 1)))
(setq i (+ i 1))
)
(command "ARC" (polar cen ang1 r1) "C" cen (polar cen ang2 r1))
(command "ARC" (polar cen ang1 r2) "C" cen (polar cen ang2 r2))
(setq mid (polar cen (+ ang1 (/ (- ang2 ang1) 2)) r2))
(command "LEADER" mid (polar mid (/ pi 2) 1.0) "" "UP" "")
(prompt "\nCurved stair created successfully.")
)
(prompt "\nSelected object is not ARC.")
)
(princ)
)
Wednesday, February 18, 2026
FREE LISP : Draw Stair Number
Auto Numbering Along a Line in PTCAD (Using LISP)
When working with drawings such as layout grids, parking numbers, seat numbers, column numbering, or coordinate markers, we often need to place numbers evenly spaced along a straight line. Doing this manually can be slow and error-prone.
This simple LISP routine helps automate the process.
What This LISP Does
The command allows the user to:
-
Specify the number of texts
-
Define the starting number
-
Set the text height
-
Pick a start point and end point
The program will then:
-
Place the first number at the start point
-
Place the last number at the end point
-
Automatically divide the space evenly
-
Insert all numbers in sequence
Example result:
1 ---- 2 ---- 3 ---- 4 ---- 5
All numbers are spaced equally along the selected line.
Why This Is Useful
This tool is especially helpful for tasks such as:
-
Column numbering in structural drawings
-
Parking lot numbering
-
Seat numbering in halls or stadiums
-
Grid labeling
-
Survey or coordinate markers
-
Repetitive annotation tasks
Instead of calculating spacing manually, the LISP automatically divides the distance and places the numbers correctly.
Tips for Best Use
✔ Use Object Snap (OSNAP)
Snap precisely to the intended start and end points.
✔ Use appropriate text height
Choose a height that matches the drawing scale.
✔ Plan the numbering direction
Numbers will increase from the first picked point toward the second point.
✔ Use it with construction lines
You can draw a temporary line as a guide and erase it afterward.
✔ Works in all CAD version support LISP
Because the routine uses standard LISP (no Visual LISP functions).
Productivity Benefit
For example:
Manual work
Place text → copy → move → edit numbers → repeat
Using this LISP
Pick start → pick end → done
What might take 2–3 minutes manually can be done in just a few seconds.
Here is VDO Link
Below is source code.
Command to run is NLL
(setq n (getint "\nNumber of texts: "))
(setq startnum (getint "\nStarting number: "))
(setq hgt (getreal "\nText height: "))
(setq p1 (getpoint "\nPick start point of line: "))
(setq p2 (getpoint p1 "\nPick end point of line: "))
(setq dx (/ (- (car p2) (car p1)) (- n 1)))
(setq dy (/ (- (cadr p2) (cadr p1)) (- n 1)))
(setq i 0)
(while (< i n)
(setq px (+ (car p1) (* i dx)))
(setq py (+ (cadr p1) (* i dy)))
(command "TEXT" (list px py) hgt "0" (itoa (+ startnum i)))
(setq i (+ i 1))
)
(princ)
)
Wednesday, January 14, 2026
FREE LISP : Draw text on pick point
In drafting work, sometimes users need to label the coordinates of multiple selected points at the same time. Normally, they have to use the text command and write the coordinates one point at a time.
Currently, AI can be used to help generate code to create a new command. We will try using AI to write a command that reads the coordinates of selected points and automatically labels the coordinates for multiple selected points simultaneously as follows.Sunday, December 7, 2025
FREELISP : Find Intersection point then draw circle or other actions
This is free LISP source code command to find intersection points from selected lines, polylines. Then draw circle at that point with specified radius size.
Here below is source code. Command is MINT
(setq elist (entget ent))
(list (list (cdr (assoc 10 elist)) (cdr (assoc 11 elist))))
)
(defun lwpoly->segments (ent / elist pts segs i)
(setq elist (entget ent))
(setq pts '())
(foreach d elist
(if (= (car d) 10)
(setq pts (append pts (list (cdr d))))
)
)
(setq segs '())
(setq i 0)
(while (< i (1- (length pts)))
(setq segs (append segs (list (list (nth i pts) (nth (1+ i) pts)))))
(setq i (1+ i))
)
;; segs
)
(defun get-segments (ent / type)
(setq type (cdr (assoc 0 (entget ent))))
(cond
((= type "LINE") (line->segments ent))
((= type "LWPOLYLINE") (lwpoly->segments ent))
(T '())
)
)
(defun intersect2 (p1 p2 p3 p4 / x1 y1 x2 y2 x3 y3 x4 y4 denom ua ub)
(setq x1 (car p1) y1 (cadr p1))
(setq x2 (car p2) y2 (cadr p2))
(setq x3 (car p3) y3 (cadr p3))
(setq x4 (car p4) y4 (cadr p4))
(setq denom (- (* (- x1 x2) (- y3 y4))
(* (- y1 y2) (- x3 x4))))
(if (equal denom 0.0 1e-9)
nil
(progn
(setq ua (/ (- (* (- x1 x3) (- y3 y4))
(* (- y1 y3) (- x3 x4)))
denom))
(setq ub (/ (- (* (- x1 x3) (- y1 y2))
(* (- y1 y3) (- x1 x2)))
denom))
(if (and (>= ua 0) (<= ua 1) (>= ub 0) (<= ub 1))
(list (+ x1 (* ua (- x2 x1)))
(+ y1 (* ua (- y2 y1)))
0.0)
nil
)
)
)
)
(defun C:MINT (/ ss n i ent segs allsegs j k pA pB pC pD ip)
(prompt "\nSelect lines/polylines: ")
(setq ss (ssget '((0 . "LINE,LWPOLYLINE"))))
(if (not ss)
(progn (princ "\nNo valid selection.") (princ))
)
;; Build list of segments
(setq allsegs '())
(setq n (sslength ss))
(setq i 0)
(while (< i n)
(setq ent (ssname ss i))
(setq segs (get-segments ent))
(setq allsegs (append allsegs segs))
(setq i (1+ i))
)
(prompt "\nIntersection points:")
(setq j 0)
(while (< j (length allsegs))
(setq k (1+ j))
(while (< k (length allsegs))
(setq pA (nth 0 (nth j allsegs)))
(setq pB (nth 1 (nth j allsegs)))
(setq pC (nth 0 (nth k allsegs)))
(setq pD (nth 1 (nth k allsegs)))
(setq ip (intersect2 pA pB pC pD))
(if ip
(progn
(princ "\n → ")
(princ ip)
(command "_.CIRCLE" ip "3") ; customizable 3 is radius size
)
)
(setq k (1+ k))
)
(setq j (1+ j))
)
(princ)
)
Monday, December 1, 2025
Get Ready : PTCAD 2026 is Launching
Announcing the Next Evolution of Reliable and Affordable DWG CAD Software
We are thrilled to announce a major milestone for our community of designers, engineers, and architects: PTCAD 2026 is officially launching on January 15, 2026!
PTCAD has always been committed to providing a powerful, cost-effective, and fully DWG-compatible CAD solution. With the release of PTCAD 2026, we are delivering on that promise by introducing significant performance boosts, smarter tools, and new features designed to streamline your workflow and dramatically enhance your productivity—all without the hefty price tag of traditional CAD subscriptions.
✨ What to Expect in PTCAD 2026
The new version focuses on three core areas: Speed, Intelligence, and Collaboration. Here’s a sneak peek at some of the key enhancements you can look forward to:
1. Worth in class
We continue to ensure PTCAD is the best alternative for interoperability in a multi-CAD environment.
- True DWG Compatibility: PTCAD 2026 fully supports the latest DWG file format, ensuring perfect fidelity when sharing files with users of other leading CAD software.
- Cost-Effectiveness : PTCAD ensures you get the tools you need for less. This reduction in software costs directly contributes to a stronger bottom line and helps your firm maximize its overall profit margins."
2. Smarter Tools
QR Code Support
Use the new QRTEXT and QRLEADER commands to embed QR codes directly into drawings—ideal for linking drawings to metadata, contacts, assets, or websites.
- Enhanced Table and MTEXT Editing Excel-style auto-fill in tables, new stacking options in MTEXT, and improved editing tools streamline data entry and annotation tasks.
- UI Features for Power Users Detached drawing windows and command-line transparency options enable advanced workflows across multiple monitors.
Asset Link function : A updated tool to manage and link non-CAD asset data (like inventory or maintenance logs) directly to objects within your DWG files.
Enhanced AutoLISP Support: For our power users, we've improved AutoLISP compatibility and performance to run your existing custom routines more efficiently.
3. Seamless Collaboration and Compatibility
Leverage your working process. Use new tool for collaborate your work continuously.
- EDM: Create professional workflow by using new tool for drawing proposed for review and approve in secure environment.
Drawing Compare Pro: Compare two versions of a drawing with greater detail and efficiency, making it easier to track changes and manage revisions.
🗓️ Mark Your Calendars!
The official launch of PTCAD 2026 is scheduled for January 15, 2026!
Starting on that date, you can download the free 30-day trial or update to new version.
Exclusive Webinar Preview!
Want to see PTCAD 2026 in action before anyone else? Join our free online webinar where our product specialists will take you on a deep dive into all the new features and answer your questions live!
Date: January 30, 2026
Time: 2pm-4pm (GMT+7)
Registration Link: see update information at https://www.facebook.com/ptcadthai
Wednesday, November 5, 2025
PTCADuser on TIKTOK Channel
Dear PTCAD blog readers,
We hope you're having a productive time using PTCAD!
We are thrilled to announce a brand-new way to connect with the team and get quick, engaging tips, tricks, and updates for your favorite design software.
The PTCAD content is now also on TikTok!
📱 Why Follow Our TikTok?
We've launched our TikTok channel to bring you fast, fun, and highly informative content perfect for designers on the go. You can expect:
⚡ Quick Tips & Tutorials: Short videos demonstrating powerful PTCAD features and hidden gems.
🛠️ Workflow Hacks: Learn efficient ways to speed up your design process.
🤩 Sneak Peeks: Get a first look at new updates, features, and content.
🤝 Community Highlights: See how other users are maximizing PTCAD in their projects.
🔗 Follow Us Now!
Ready to level up your PTCAD skills in just 60 seconds?
Click the link below and hit 'Follow'!
(9)ptcaduser (@ptcaduser) | TikTok
We can't wait to see you there! We encourage you to like, share, and comment on our videos—let us know what quick tutorials you'd like to see next!
Sincerely yours,
PTCADuser team
Wednesday, October 15, 2025
FREELISP : Scale selected object 2 times
This is shortcut command to scale selected object bigger 2 times refer selected reference clicked point.
--------------
Tip : user can adjust scale size by changing number in this line in source code
(command "_.SCALE" ss "" basept "2")
Thursday, September 18, 2025
Creating advance block (dynamic)
Mastering PTCAD Advance Blocks: A Step-by-Step Guide
PTCAD also provide function similar to advance block called "advance block". Allowing you to create intelligent, flexible block definitions that can be easily modified without having to insert new blocks or explode existing ones. This guide will walk you through the fundamentals of advance blocks, from understanding their components to creating a practical example.
Why Use Advance Blocks?
Imagine you're designing a room and need various door sizes (70cm, 80cm, 90cm, etc.). Without advance blocks, you'd either create a separate block for each size or manually scale and adjust a generic door block every time. With a advance door block, you can simply stretch it to the desired width, saving immense time and ensuring consistency.
Key Benefits:
Increased Efficiency: Modify block geometry on the fly.
Reduced File Size: One advance block can replace multiple static blocks.
Improved Accuracy: Maintain design standards and prevent errors.
Enhanced Productivity: Spend less time drafting and more time designing.
The Anatomy of a advance Block: Parameters and Actions
Every advance block is built upon two core elements that work together within the Block Editor:
Parameters (The Controls): These define the custom properties and grips that appear when you select the advance block in your drawing. They control what can be changed and provide the visual handles for manipulation.
Examples: Linear (for distance), Rotation (for angle), Point (for location), Flip (for mirroring), Visibility (for showing/hiding geometry).
Actions (The Behavior): These are the rules that dictate how the selected geometry within the block changes when its associated parameter is manipulated. An action links to a parameter and defines a selection set of objects it will affect.
Examples: Stretch (to resize), Move (to relocate), Rotate (to spin), Scale (to proportionally resize), Array (to create patterns).
When you combine a Parameter with an Action, you give your block its "advance" intelligence.
Step-by-Step Example: Creating a Resizable Door
Let's create a simple advance block: a rectangle that can be stretched horizontally and vertically. This is a fundamental skill that applies to many real-world objects like windows, doors, tables, and more.
Phase 1: Create the Base Block Geometry
Draw 2 Rectangles as door: In a new or existing drawing, use the RECTANG command to draw a simple rectangle. Make it an arbitrary size, for example, @70,120 (70 cm unit wide, 120 cm unit high).
Define as a Block:
1. Type BLOCK and press Enter to open the Block Definition dialog.
2. Name: Give it a descriptive name, e.g., "Door01".
3. Pick Point: Click "Pick Point" and select the bottom-left corner of your rectangle (this will be the block's base point).
at Objects: Click "Select Objects," select your rectangle, and press Enter.
Ensure "Convert to block" is selected.
4. Click "OK." Your door is now a standard block.
Phase 2: Enter the Block Editor and Add Dynamics
Open Block Editor: Double-click your newly created block. This will open the Block Editor environment, indicated by a grey background and the Block Authoring Palettes (Parameters, Actions, Parameter Sets, Constraints).
Add a Horizontal Linear Parameter:
From the Block Authoring Palettes (usually on the left), click the Parameters tab.
Select Linear.
Click the bottom-left corner of the door , then click the bottom-right corner.
Drag the dimension label (e.g., "Distance1") above the rectangle and click to place it.
Result: You'll see a linear parameter with blue grips.
Add a Vertical Linear Parameter:
Repeat the process, but click the bottom-left corner and then the top-left corner.
Place the dimension label (e.g., "Distance2") to the left of the rectangle.
Add a Horizontal Stretch Action:
From the Actions tab, click Stretch.
Select parameter: Click on the "Distance1" parameter label.
Specify parameter point to associate with action: Click the blue grip on the right side of "Distance1" (this is the grip that will control the stretch).
Specify first corner of stretch frame: Draw a crossing window that includes the entire right side of the rectangle (the top-right and bottom-right corners). This defines what geometry will be stretched.
Select objects: Select the entire rectangle (all four lines) and press Enter.
Add a Vertical Stretch Action:
Repeat the Stretch action.
Select parameter: Click on the "Distance2" parameter label.
Specify parameter point to associate with action: Click the blue grip on the top side of "Distance2".
Specify first corner of stretch frame: Draw a crossing window that includes the entire top side of the rectangle (the top-left and top-right corners).
Select objects: Select the entire rectangle and press Enter.
Phase 3: Test and Save
Test Block: On the Block Editor ribbon, click Test Block. This opens a temporary environment where you can try out your advance block.
Select the rectangle. You should see the blue grips corresponding to your parameters.
Click and drag the horizontal grip to stretch the width.
Click and drag the vertical grip to stretch the height.
User can see sample VDO at https://youtu.be/-mZ9Sfrexlk?si=SKoxXoCsbYytUJBe
Tuesday, August 5, 2025
FREELISP : Write, List, Export selected Coordinates
If user have many points in drawing and want to
- Write Coordinate text at point
- Sort all selected points in 4 direction : Left to Right , Right to Left, Upwards, Downwards
- Export sorted list to text file in format x,y,z
((null lst) (list pt))
((or
(and (= dir "L") (< (car pt) (car (car lst))))
(and (= dir "R") (> (car pt) (car (car lst))))
(and (= dir "U") (< (cadr pt) (cadr (car lst))))
(and (= dir "D") (> (cadr pt) (cadr (car lst))))
)
(cons pt lst)
)
(T (cons (car lst) (insert-by-direction pt (cdr lst) dir)))
)
)
(defun insertion-sort-dir (pt-list dir)
(if (null pt-list)
nil
(insert-by-direction (car pt-list) (insertion-sort-dir (cdr pt-list) dir) dir)
)
)
(defun c:COMPAREPTSXY ( / ss i ent ed pt pt-list sorted idx dir x y txtpt txtfile)
(prompt "\n Sort Direction:")
(prompt "\n L = Left → Right, R = Right → Left, U = Down → Up, D = Up → Down")
(initget "L R U D")
(setq dir (getkword "\nPls specify direction [L/R/U/D] <L>: "))
(if (not dir) (setq dir "L"))
;; เลือก POINT
(prompt "\nSelect points: ")
(setq ss (ssget '((0 . "POINT"))))
(if ss
(progn
(setq pt-list '()
i 0)
;; Read objects
(while (< i (sslength ss))
(setq ent (ssname ss i)
ed (entget ent)
pt (cdr (assoc 10 ed)))
(if pt
(setq pt-list (cons pt pt-list))
)
(setq i (1+ i))
)
;; Sort by direction
(setq sorted (insertion-sort-dir pt-list dir))
(setq txtfile (open "d://pointexport.TXT" "w")) ;;=======
;; display 30 degree TEXT Coord at point
(prompt (strcat "\n--- List by wanted direction " dir " ---"))
(setq idx 1)
(foreach p sorted
(setq x (rtos (car p) 2 2))
(setq y (rtos (cadr p) 2 2))
;; print in Command Line
(prompt (strcat "\n" (itoa idx)
". X: " x ", Y: " y
", Z: " (rtos (if (caddr p) (caddr p) 0.0) 2 2)))
;; place TEXT on coord
(command "TEXT" p 0.8 30 (strcat x "," y))
;; write coord to file
(write-line (strcat x ","y",0.0") txtfile)
(setq idx (1+ idx))
)
(close txtfile)
(prompt "\n✅ Coordinate written to file 'pointexport.TXT'")
(prompt "\n-------------------------------------------")
)
(prompt "\n No POINT selection.")
)
(princ)
)
Friday, July 25, 2025
FREELISP : Find, mark and count line intersections
If you want to find, mark and count line intersections, you can let ChatGPT help you code LISP program and run as VDO.
@ptcaduser PTCAD-Intersect mark #ptcad #lisp #intersection #cad
♬ original sound - ptcaduser
Command : Intcnt
Source code
(setq x1 (car a1) y1 (cadr a1)
x2 (car a2) y2 (cadr a2)
x3 (car b1) y3 (cadr b1)
x4 (car b2) y4 (cadr b2))
(setq denom (- (* (- x1 x2) (- y3 y4)) (* (- y1 y2) (- x3 x4))))
(if (not (equal denom 0.0 1e-8))
(progn
(setq ua (/ (- (* (- x1 x3) (- y3 y4)) (* (- y1 y3) (- x3 x4))) denom))
(setq ub (/ (- (* (- x1 x3) (- y1 y2)) (* (- y1 y3) (- x1 x2))) denom))
(if (and (>= ua 0.0) (<= ua 1.0) (>= ub 0.0) (<= ub 1.0))
(list (+ x1 (* ua (- x2 x1)))
(+ y1 (* ua (- y2 y1)))
0.0)
)
)
)
)
(defun draw-colored-circle (pt rad color)
(entmakex (list
(cons 0 "CIRCLE")
(cons 10 pt)
(cons 40 rad)
(cons 62 color))) ; 1 = red
)
(defun c:intcnt ( / ss i j e1 e2 ent1 ent2 ptA1 ptA2 ptB1 ptB2 ip radius count)
(prompt "\nSelect LINE objects to check intersections: ")
(setq ss (ssget '((0 . "LINE")))) ; Support LINEs only for now
(if ss
(progn
(initget 7)
(setq radius (getreal "\nEnter radius for intersection marks: "))
(setq count 0)
(setq i 0)
(while (< i (sslength ss))
(setq e1 (ssname ss i)
ent1 (entget e1)
ptA1 (cdr (assoc 10 ent1))
ptA2 (cdr (assoc 11 ent1)))
(setq j (1+ i))
(while (< j (sslength ss))
(setq e2 (ssname ss j)
ent2 (entget e2)
ptB1 (cdr (assoc 10 ent2))
ptB2 (cdr (assoc 11 ent2)))
(setq ip (intersect-line-line ptA1 ptA2 ptB1 ptB2))
(if ip
(progn
(draw-colored-circle ip radius 4) ; cyan
(setq count (1+ count))
)
)
(setq j (1+ j))
)
(setq i (1+ i))
)
(prompt (strcat "\nNo. of Intersections: " (itoa count)))
)
(prompt "\nNo valid LINE objects selected.")
)
(princ)
)
Wednesday, June 11, 2025
Draw mechanical details with PTCAD Plus - MEC
Draw mechanical details with PTCAD Plus - MEC
Angle, Bearing, Bushing, Caster,
Coupling, Hinge, Key, Lever,
Nut, Pulley, Screw & Bolt, Spring,
Steel Shapes, Channel, Equal Angle, H-Section, Washer
- Library
user can choose wanted symbol by clicking at symbol then press middle button to insert symbol into drawing then do left click to place symbol at wanted location. - Part Generator
User can choose wanted part symbols as Gear , Belt ,Bolt by clicking at symbol then press middle button to put value of symbols then follow enter value steps before insert symbol into drawing - BOM or Bill Of Materials
After use insert many mechanical symbols, program will count all symbols into BOM which can copy and paste into MSEXCEL sheet.
Monday, June 9, 2025
How to set alias command to work faster
How to set alias command to work faster
- Type ALIASEDIT in the command line
Program will display dialog as this
- Click at New button
- Enter wanted alias command (PN in this sample)
- In Available command , scroll to wanted command to match with alias command, click at that command.
- Click Assign button to match alias command and full command
- Click Close button to end command
- Try using alias command (PN in this sample)
Wednesday, May 28, 2025
Process diagram made easy with PTCAD Plus - P&ID Lite
P&ID stands for Piping and Instrumentation Diagram. It is a detailed diagram in the process industry that shows the piping and related components of a physical process flow. These diagrams are essential tools used in engineering design and plant operation.
Key Elements of a P&ID
A P&ID typically includes:
- Valves (manual, automatic, pressure relief, etc.)
- Instrumentation (pressure gauges, flow meters, sensors, transmitters)
- Control systems (PLC, DCS, and their logic interfaces)
- Equipment (pumps, compressors, tanks, heat exchangers, reactors)
- Flow directions and connection points
Purpose of a P&ID
Design Documentation: Helps in visualizing how the system will work.
Engineering & Construction: Guides installation and maintenance teams.
Operations: Used by operators for understanding and troubleshooting systems.
Safety & Compliance: Critical for hazard and operability studies (HAZOP).
PTCAD plus edition provides module help user draw P&ID Diagram easily called P&ID Lite. Not only lines and industrial symbols, P&ID Lite attachs data to each symbols inserted to drawing. This mean after user draw P&ID diagram, user will get equipment report data can be view in PTCAD and also able to export to MS Excel file.
Kindly refer to the example video as a guideline for using the software.
@ptcaduser PTCAD-PIDLITE #P&IDdiagrm #ptcad #cad #pid #bom #valve
♬ original sound - ptcaduser
Monday, May 19, 2025
Sheet Metal Drawing easily in PTCAD Plus
At Plus Tools menu user will see ribbons as image
- Cone
- Cylinder
- Rectangle Transform or Resize
- Three Ways Cylinder
- 90 Degree Cylinder Elbow
- Duct Transform
Ai can work in PTCAD
Here is VDO show how we can prompt to create rendering image by using Ai in PTCAD
-
Mastering PTCAD Advance Blocks: A Step-by-Step Guide PTCAD also provide function similar to advance block called "advanc...
-
This is free LISP source code command to find intersection points from selected lines, polylines. Then draw circle at that poi...
-
Improving Drawing Quality with an Ortho-Check LISP Tool In many CAD workflows, especially in architectural, engineering, and construction...














