Lisp to create a MATCHLINENUMBER function in Plant 3D

Lisp to create a MATCHLINENUMBER function in Plant 3D

iain.stewartCDU9L
Enthusiast Enthusiast
2,314 Views
9 Replies
Message 1 of 10

Lisp to create a MATCHLINENUMBER function in Plant 3D

iain.stewartCDU9L
Enthusiast
Enthusiast

Hi folks,

 

New to LISP and looking for a starter to retrieve a line number tag from a pipe/fitting that is selected and match to another, similar to the MATCHPROP command.

 

Any help would be greatly appreciated.

 

Thanks

 

Iain

0 Likes
Accepted solutions (1)
2,315 Views
9 Replies
Replies (9)
Message 2 of 10

ВeekeeCZ
Consultant
Consultant

Use THIS function and select your source object. See the listing if there your property is listed and post that line here.

Message 3 of 10

iain.stewartCDU9L
Enthusiast
Enthusiast

Hi,

 

Thanks for the quick response.

 

Line in bold and underlined is what I require.

 

Thanks

 

Iain

 



Select object: ; IAcPnP3dPipe: IAcPnP3dPipe Interface
; Property values:
; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff7b0ec4e50>
; CutLength (RO) = "2642.03781"
; Document (RO) = #<VLA-OBJECT IAcadDocument 00000232b3bef0b8>
; EndType (RO) = "PPL"
; EntityTransparency = "ByLayer"
; Facing (RO) = ""
; Handle (RO) = "2B22A"
; HasExtensionDictionary (RO) = 0
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000232a5f98858>
; InsulationThickness (RO) = ""
; InsulationType (RO) = ""
; Layer = "DEA708-0.5-CLCR-___-W185"
; LineNumberTag (RO) = "DEA708-0.5-CLCR-***-W185"
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; MaterialCode (RO) = ""
; ObjectID (RO) = 42
; ObjectName (RO) = "AcPpDb3dPipe"
; OwnerID (RO) = 43
; PartFamilyLongDesc (RO) = "PARKER, PUSH-LOK PLUS, FLEXIBLE HOSE - YELLOW"
; PlotStyleName = "Color_5"
; PnPClassName (RO) = "Pipe"
; PnPGuid (RO) = "67deca89-f026-402d-9691-4a298d1c266e"
; PnPMaterial (RO) = "SYNTHETIC RUBBER"
; PressureClass (RO) = ""
; Schedule (RO) = ""
; Service (RO) = ""
; Size (RO) = "1/2\""
; Spec (RO) = "6EEP"
; Status (RO) = "New"
; Tag (RO) = ""
; TieInNumber (RO) = ""
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000232a5f97a70>
; Visible = -1
; WallThickness (RO) = ""
; Methods supported:
; ArrayPolar (3)
; ArrayRectangular (6)
; Copy ()
; Delete ()
; GetBoundingBox (2)
; GetExtensionDictionary ()
; GetXData (3)
; Highlight (1)
; IntersectWith (2)
; Mirror (2)
; Mirror3D (3)
; Move (2)
; Rotate (2)
; Rotate3D (3)
; ScaleEntity (2)
; SetXData (2)
; TransformBy (1)
; Update ()

0 Likes
Message 4 of 10

ВeekeeCZ
Consultant
Consultant

Well, we can read it, possibly place it to the clipboard, but did not realize that it would be RO read-only. 

I would suggest getting this to the Plant forum. 

0 Likes
Message 5 of 10

iain.stewartCDU9L
Enthusiast
Enthusiast

Ok, thanks.

 

Do you have a suggestion on a lisp to read this and copy to clipboard - even that would speed up my current workflow.

 

Many thanks

 

Iain

0 Likes
Message 6 of 10

ВeekeeCZ
Consultant
Consultant
Accepted solution

Sure.

 

(vl-load-com)

(defun c:LineNumClip ( / ent obj text html)
  
  (and (setq ent (car (entsel "\nSelect a source of LineNumberTag: ")))
       (setq obj (vlax-ename->vla-object ent))
       (vlax-property-available-p obj 'LineNumberTag)
       (setq text (vlax-get-property obj 'LineNumberTag))
       (princ (strcat "\nClipboard: " text))
       (vlax-invoke (vlax-get (vlax-get (setq html (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'setData "Text" text)
       (vlax-release-object html)
       )
  (princ)
  )

 

Message 7 of 10

iain.stewartCDU9L
Enthusiast
Enthusiast

Amazing - thanks for that. I will now create a macro using this and the LINENUMBERTAG command to do what i need to do.

0 Likes
Message 8 of 10

Koosha.yousefi6ZMHP
Contributor
Contributor

Hey 🙂

Did you manage to solve this issue? 

Regards

0 Likes
Message 9 of 10

iain.stewartCDU9L
Enthusiast
Enthusiast
Unfortunately it won't be achievable in lisp as stated above. The copy to clipboard helps a lot though.
0 Likes
Message 10 of 10

robert.barryWUWN6
Participant
Participant

This is not a lisp routine way but this is how I match pipe line numbers in PLANT3D

 

1st: Select an object with the line number that you want the other objects to match.

2nd: Select the other objects now.

3rd: Go to to properties (with objects still selected).

4th: Pick "Line Number Tag" Dropdown

5th: Go all way to the top of the line numbers used list and click on "new..." , alternatively hit "ctrl-home".  This will activate the new line number dialog box.

(The latter is a quicker way, using less mouse action).

Last: The info in the "Assign Tag"  dialog box will have stored first selected objects line number info.

Pick the "Assign" button or simply just hit enter.

 

The line number matching is now complete.

 

All objects picked after the first selected object will now match the first selected object. In other words,

The first object picked piping object will always set the line number for the subsequent selected piping objects.

Using the right click context menu "add to selection" then "Connected Line number" is a useful way to change/match entire line numbers.

Only 3d piping objects can be selected. the properties will not display the line number in the properties box if non PLANT3d entities, like lines or polylines, etc. are also included in the selection.

I know this is is a bit unintuitive, having to hit "new" line number to match existing line numbers of other existing line numbers, but it works.

 

Hope this is helpful

Robert