Jump to content

lisp to place "points" at midpoint of pipe fittings


pipefitter72

Recommended Posts

We have been manually placing control points at the midpoint of pipe fittings. The "point" is actually a small CADMEP object.We do this to export to a robotic station for marking locations in field. I have been trying to modify a lisp I found to automate placing the "points". What I would like to do is place a point in drawing and copy it to midpoint of all selected fittings. I am just not grasping what I need to do the get the midpoints of the fittings and either copy or insert the "point".

I have attached the lisp I was attempting to modify. Can someone point me in the right direction?

copypastetest.lsp

Link to comment
Share on other sites

We have been manually placing control points at the midpoint of pipe fittings. The "point" is actually a small CADMEP object.We do this to export to a robotic station for marking locations in field. I have been trying to modify a lisp I found to automate placing the "points". What I would like to do is place a point in drawing and copy it to midpoint of all selected fittings. I am just not grasping what I need to do the get the midpoints of the fittings and either copy or insert the "point".

I have attached the lisp I was attempting to modify. Can someone point me in the right direction?

 

hi pipefitter72

welcome to forum :)

 

i assume your pipe is line object..

 

(defun c:Test1 (/ *error* ss s p i e cm es)
 (defun *error* (x)
   (if	cm
     (setvar 'cmdecho cm)
     ) ;_ end of if
   (princ "\n*Cancel*")
   ) ;_ end of defun

 (if (and (setq ss (ssget))
[color="gray"];;;           (setq ss (osnap (cadr es) "mid"))  ;<---- incorrect due ss not consp [/color]
   (setq s (ssget "_:L"))
   (setq p (getpoint "\n Specify base point :"))
   ) ;_ end of and
   
   (progn (setq cm (getvar 'cmdecho))
   (setvar 'cmdecho 0)
   (command "_._copybase" "_non" p s "")
   (repeat (setq i (sslength ss))
     (setq e (entget (ssname ss (setq i (1- i)))))
     
[color="gray"];;;             (foreach pt e
;;;               (if (eq (car pt) 10)
;;;                 (command "_.pasteclip" (cdr pt))
;;;               )
;;;             )[/color]
     
[color="#696969"];;suggest by hanhphuc (for line only)[/color]
 [color="red"]    (if (eq (cdr (assoc 0 e)) "LINE") ;<--- assume the pipe object is line
       (command	"_.pasteclip"
		(apply 'mapcar
		       (cons ''((a b) (/ (+ a b) 2.)) (mapcar ''((x) (cdr (assoc x e))) '(10 11)))
		       ) ;_ end of apply
		) ;_ end of command
       ) ;_ end of if[/color]
     
     ) ;_ end of repeat
   (setvar 'cmdecho cm)
   ) ;_ end of progn
   ) ;_ end of if
 ) ;_ end of defun

 

since you know coding, above is simple tweak vanilla (line object only)

for advanced you can attemp VL's vlax-curve* almost similar recent thread here

Edited by hanhphuc
comment: ....ss not consp
Link to comment
Share on other sites

Thanks for looking at this. My fittings are cadmep pipe fittings. I apologize for not being more clear to begin with.Here is a screen shot of what I am trying to accomplish.

cp.JPG

Link to comment
Share on other sites

hi pipefiter72,

Is CADMEP object, a block? shape? or customized?

The centroid (midpoint) normally is its property insertion point etc..

im not sure MEP is a proxy object?

can you attach drawing? (prefer 2007) *maybe others member can help too*

Link to comment
Share on other sites

hi friend, as expected the dwg shows nothing.

i set PROXYSHOW =1 also not working too.

 

i'll try to download enabler from your link...

 

[EDIT] but get this can't proceed next

mep.png

 

meanwhile i hope somebody using MEP could help you too :)

regards

Edited by hanhphuc
Link to comment
Share on other sites

A work around if you can touch the object then you can retrieve the properties of the object like insert point, if you know scale and rotation then you can work out as a code example some point on a block. The problem like CIV3d you have to "open" the database to get at object properties. For a start use Dumpit.lsp and pick object this will give some clues. Paste output here. I am sure there are some MEP enquiry examples here.

 

;;; Dump all methods and properties for selected objects              ;
;;;===================================================================; 
;;; DumpIt                                                            ; 
;;;-------------------------------------------------------------------; 
;;;===================================================================; 
(defun C:DumpIt ( / ent) 
 (while (setq ent (entsel)) 
   (vlax-Dump-Object 
     (vlax-Ename->Vla-Object (car ent)) 
   ) 
 ) 
 (princ) 
)

Link to comment
Share on other sites

earlier in the thread I posted a screen shot. and I posted 2 links to dropbox. one is for 2014 dwg and other is same dwg in 2007 format. If you do not have MEP you might have to install mep object enablers for your version of autocad from website.

http://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/ENU/123112/files/autocad-object-enablers-html.html

Link to comment
Share on other sites

Dumpit results

 

Select object: ; IMapsComWrap: IMapsComWrap Interface

; Property values:

; Application (RO) = #

; Area = 0.0

; CustomData = "GPM - KW/Steps - Louver Free Area = 0.0,Motor HP = ,Pump Impeller = ,Equipment Tag (all) = ,Max/Min CFM - CFM = ,Model # = ,Motor Frame = ,PIU Fan CFM - Pump Head = ,Manufacturer = Weldbend,Vert/Horz FD - Voltage/PH = ,Instructions - FD Access Door = ,L?"

; Description = "S40 LR 90 [ 3 ]"

; Document (RO) = #

; Elevation = "CL=10'-8\""

; EndSize = "BE 3, BE 3, "

; EntityTransparency = "ByLayer"

; Handle (RO) = "1009A"

; HasExtensionDictionary (RO) = 0

; Hyperlinks (RO) = #

; ItemNumber = "4"

; Layer = "MP-JTFR"

; LengthAngle = 90.0

; Linetype = "BYLAYER"

; LinetypeScale = 1.0

; Lineweight = -1

; Material = "ByLayer"

; Notes = ""

; ObjectID (RO) = 42

; ObjectID32 (RO) = 42

; ObjectName (RO) = "MapsContainer"

; OwnerID (RO) = 43

; OwnerID32 (RO) = 43

; PlotStyleName = "ByLayer"

; Points = "ENDPOINTS: 19670.48,8807.07,1328.00;19665.98,8802.57,1328.00; MIDPOINT: 19665.98,8807.07,1328.00"

; Section = "Level 1"

; ServiceName = "JTFR Anvil2Thrd150MIxS40"

; Status = " 0: Design"

Select object: ; TrueColor = #

; Visible = -1

; Weight = 4.8

Command:

Link to comment
Share on other sites

The dump gives some clues "Points" is handy draw a line using the co-ords and see where it fits make sure snap is off, scale same object by 2 times see if the line length is twice . Compare two objects rotated 90 degs and see if "lengthangle" changes. If you think of the object as a block then its possible to work out the mid pt you need.

 

Do you have a block called JTFR Anvil2Thrd150MIxS40 ?

Link to comment
Share on other sites

Dumpit results

 

Select object: ; IMapsComWrap: IMapsComWrap Interface

; Property values:

...

...

; Points = "ENDPOINTS: 19670.48,8807.07,1328.00;19665.98,8802.57,1328.00; MIDPOINT: 19665.98,8807.07,1328.00"

...

...

...

Thank you BIGAL, though i can't help in this thread ,just curious if we can handle proxy object it could be useful :)

as shown the points type is 'STR, maybe "...MIDPOINT:19665.98,8807.07,1328.00" is the key?

Link to comment
Share on other sites

Just curious if you have tried the Autodesk point layout software?

 

http://knowledge.autodesk.com/support/autocad/learn-explore/caas/blog/beyonddesign.typepad.com/posts/2014/06/point-layout-2015-is-here.html

 

I have no idea how much it cost, but they do have a trial version. We are still tape measure and string, so dimensions are all I use. I see the other trades all using the total station on the last few jobs.

Link to comment
Share on other sites

Pipefitter72 went to download enabler but its 200+mb so gave up for moment if you can get some object dumps then their may be some patterns appearing and code can be written blind.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...