Author Topic: Match properties for pline  (Read 10982 times)

0 Members and 1 Guest are viewing this topic.

TJAM51

  • Guest
Match properties for pline
« on: March 06, 2006, 10:44:06 AM »
I know the standard match properties will match color, linetype, etc...but is there a way for a lisp routine to match the actual pline width?



Thanks

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Match properties for pline
« Reply #1 on: March 06, 2006, 11:27:31 AM »
Yes.  If it has a constant width, then I would use ActiveX properties, but if the width varies, then I would use the dxf code.
Quote
Select entity:  ; IAcadLWPolyline: AutoCAD Lightweight Polyline Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00b60584>
;   Area (RO) = 761.885
;   Closed = -1
;   ConstantWidth = 0.5
;   Coordinate = ...Indexed contents not shown...
;   Coordinates = (179.308 147.292 178.517 163.528 161.837 168.197 ... )
;   Document (RO) = #<VLA-OBJECT IAcadDocument 01060bf0>
;   Elevation = 0.0
;   Handle (RO) = "3A"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 03061a54>
;   Layer = "Cloud-1"
;   Length (RO) = 99.6581
;   Linetype = "ByLayer"
;   LinetypeGeneration = 0
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 2130116048
;   ObjectName (RO) = "AcDbPolyline"
;   OwnerID (RO) = 2130115848
;   PlotStyleName = "ByLayer"
;   Thickness = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 03066e40>
;   Visible = -1

Quote
Entget of entity selected:
(-1 . <Entity name: 7ef6fdd0>)
(0 . "LWPOLYLINE")
(330 . <Entity name: 7ef6fd08>)
(5 . "3A")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "Cloud-1")
(100 . "AcDbPolyline")
(90 . 5)
(70 . 1)
(38 . 0.0)
(39 . 0.0)
(10 179.308 147.292)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 178.517 163.528)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 161.837 168.197)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 152.275 161.588)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 155.367 145.425)
(40 . 0.03125) ; <----------Starting width of pline segment
(41 . 0.0)
(42 . 0.506788) ; <---------Ending width of pline segment
(210 0.0 0.0 1.0)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Match properties for pline
« Reply #2 on: March 06, 2006, 11:35:39 AM »
Entget of entity selected:
(-1 . <Entity name: 7ef6fdd0>)
(0 . "LWPOLYLINE")
(330 . <Entity name: 7ef6fd08>)
(5 . "3A")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "Cloud-1")
(100 . "AcDbPolyline")
(90 . 5)
(70 . 1)
(38 . 0.0)
(39 . 0.0)
(10 179.308 147.292)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 178.517 163.528)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 161.837 168.197)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 152.275 161.588)
(40 . 0.03125)
(41 . 0.0)
(42 . 0.506788)
(10 155.367 145.425)
(40 . 0.03125) ; <----------Starting width of pline segment
(41 . 0.0)          ;<---------Ending width of pline segment
(42 . 0.506788)
(210 0.0 0.0 1.0)
« Last Edit: March 06, 2006, 11:57:07 AM by ElpanovEvgeniy »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Match properties for pline
« Reply #3 on: March 06, 2006, 11:38:58 AM »
Code: [Select]
10
 Vertex coordinates (in OCS), multiple entries; one entry for each vertex
DXF: X value; APP: 2D point
 
40
 Starting width (multiple entries; one entry for each vertex)
(optional; default = 0; multiple entries). Not used if constant width (code 43) is set
 
41
 End width (multiple entries; one entry for each vertex)
(optional; default = 0; multiple entries). Not used if constant width (code 43) is set
 
42
 Bulge (multiple entries; one entry for each vertex) (optional; default = 0)
 

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Match properties for pline
« Reply #4 on: March 06, 2006, 11:53:18 AM »
Thanks for the clarification Elpanov.  :-)
I did it too fast this morning. :cry: :oops:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

TJAM51

  • Guest
Re: Match properties for pline
« Reply #5 on: March 07, 2006, 07:54:19 AM »
I realize the information you have given me is great but I do not fully understand it. I was hoping to obtain a routine that could be loaded and ran at the command line. I may not have been very clear about this...thanks

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Match properties for pline
« Reply #6 on: March 07, 2006, 08:05:30 AM »
I realize the information you have given me is great but I do not fully understand it. I was hoping to obtain a routine that could be loaded and ran at the command line. I may not have been very clear about this...thanks

http://www.theswamp.org/index.php?topic=8878.0
 Generate a Pline from a list of points?
« Reply #7 on: 03-03-2006, 17:45:30 »

TJAM51

  • Guest
Re: Match properties for pline
« Reply #7 on: March 07, 2006, 08:07:42 AM »
If I have two plines, one is 2" wide and the other is 1" wide. I would like to pick one and then the other and the second takes on the width of the first. It would be like match properties but the width of the pline would be included.

Fatty

  • Guest
Re: Match properties for pline
« Reply #8 on: March 07, 2006, 10:15:07 AM »
If I have two plines, one is 2" wide and the other is 1" wide. I would like to pick one and then the other and the second takes on the width of the first. It would be like match properties but the width of the pline would be included.

Try this one but quick and dirty...

Code: [Select]
(defun C:pm (/ obj1 obj2 prop_list val_list)
  (vl-load-com)
  (setq en1 (car (setq ent1 (entsel "\n >> Polyline #1 >>\n")))
en2 (car (setq ent2 (entsel "\n >> Polyline #2 >>\n"))))
 
  (if (and ent1 ent2)
    (progn
      (setq obj1 (vlax-ename->vla-object
       en1)
obj2 (vlax-ename->vla-object
       en2)
  )
      (if (and (wcmatch (vla-get-objectname obj1) "AcDbPolyline")
       (wcmatch (vla-get-objectname obj2) "AcDbPolyline"))
(progn
      (setq val_list
     (mapcar (function (lambda (x)
(vlax-get-property obj1 x)
       )
     )
     (setq prop_list (list
       "Color"
       "Constantwidth"
       "Layer"
       "Linetype"
       "Linetypegeneration"
       "Linetypescale"
       "Lineweight"
      )
     )
     )
      )

      (mapcar (function (lambda (x y)
  (if
    (vlax-property-available-p obj2 x T)
     (vlax-put-property obj2 x y)
  )
)
      )
      prop_list
      val_list
      )
      (vla-update obj2)
      (mapcar 'vlax-release-object (list obj1 obj2))
    )
   (alert "Incorrect object type...")
)
      )
    (alert "Both pline not selected\nyou missed...")
  )
  (princ)
)
  (prompt "\n")
  (prompt "\nType PM to execute\n")

~'J'~

GDF

  • Water Moccasin
  • Posts: 2081
Re: Match properties for pline
« Reply #9 on: March 07, 2006, 11:00:14 AM »
Using 2005 and 2006 matchproperties will match pline width, linetype, layer.....

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

TJAM51

  • Guest
Re: Match properties for pline
« Reply #10 on: March 07, 2006, 11:10:29 AM »
I am using 2002 lt. I use Lt-extender to run lisp. The routine above which I appreciate deeply seems not to work. I receive the following error message....


Command: ; error: bad argument type: numberp: nil



T.Willey

  • Needs a day job
  • Posts: 5251
Re: Match properties for pline
« Reply #11 on: March 07, 2006, 11:18:19 AM »
See if this will work for you.  All it will do is match the constant width of one pline to another.

Code: [Select]
(defun c:PlMatchWidth (/ Sel Obj1 Obj2)

(vl-load-com)
(and
 (setq Sel (entsel "\n Select polyline with width desired: "))
 (setq Obj1 (vlax-ename->vla-object (car Sel)))
 (setq Sel (entsel "\n Select polyline to assign new width to: "))
 (setq Obj2 (vlax-ename->vla-object (car Sel)))
 (if
  (and
   (vlax-property-available-p Obj1 'ConstantWidth)
   (vlax-property-available-p Obj2 'ConstantWidth)
  )
  (vla-put-ConstantWidth Obj2 (vla-get-ConstantWidth Obj1))
 )
)
(princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Fatty

  • Guest
Re: Match properties for pline
« Reply #12 on: March 07, 2006, 11:50:28 AM »
I am using 2002 lt. I use Lt-extender to run lisp. The routine above which I appreciate deeply seems not to work. I receive the following error message....


Command: ; error: bad argument type: numberp: nil




I have copied this listing I sent here, then I loaded them
on my computer and this works fine for me
but I use A2005 eng. only


~'J'~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Match properties for pline
« Reply #13 on: March 07, 2006, 05:14:44 PM »
< .. snip .. >
http://www.theswamp.org/index.php?topic=8878.0
 Generate a Pline from a list of points?
« Reply #7 on: 03-03-2006, 17:45:30 »

Evgeniy,
Try this when you want to LINK to a POST REPLY


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Match properties for pline
« Reply #14 on: March 07, 2006, 05:23:01 PM »
>Kerry Brown
Thanks! :-)