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

(defun intersect-line-line (a1 a2 b1 b2 / x1 y1 x2 y2 x3 y3 x4 y4 denom ua ub)
  (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


            PTCAD Plus edition contains many plug-ins  AECplus, MEC, Assetlink which can help user draw detail drawing faster normal commands

            MEC is plug-ins to help user draw detail of mechanical drawing including standard symbols  of mechanical part such as 

Angle, Bearing, Bushing, Caster,
Coupling, Hinge, Key, Lever,
Nut, Pulley, Screw & Bolt, Spring,
 Steel Shapes, Channel, Equal Angle, H-Section, Washer


                User can call mechanical functions by type  MECHLIB  command   program will show dialog to show symbols library as image


        There are three functions in dialog
  1. 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.

  2. 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   




  3. 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.


            Mechanical module in PTCAD Plus provide standard symbols in one stop command. This help user draw mechanical drawing complete faster. 


Monday, June 9, 2025

How to set alias command to work faster

 How to set alias command to work faster 


         To set up alias command, there is way to do


        Use command  ALIASEDIT 


  1. Type ALIASEDIT in the command line

    Program will display dialog as this
            If user want to create new alias command   
  1. Click at New button
  2. Enter wanted alias command (PN in this sample)
  3. In Available command , scroll  to wanted command to match with alias command, click at that command.
  4. Click Assign button   to  match  alias command and full command
  5. Click    Close button to end command
  6. Try using  alias command (PN in this sample) 

            User can import or export  alias command files  .ica  or .pgp (from AutoCAD) when migrate from other CAD to use PTCAD.

            Alias command is just basic step to type short command to run the command but entering parameters or options in command , user must do by yourself.   If user want simplify steps of command usage, user can develop your own command by cerating LISP command.





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:

- Pipes and fittings (with sizes, types, and specifications)
- 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

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 PT...