Author Topic: LISP to link a field to VPORT scale  (Read 340 times)

0 Members and 1 Guest are viewing this topic.

Gambit80

  • Mosquito
  • Posts: 2
LISP to link a field to VPORT scale
« on: February 24, 2024, 01:00:10 PM »
I am looking to see if it is possible to use LISP to link a VPORT scale to an Attribute in a block.

Would like to allow user to place our North Arrow block in a drawing, which would prompt for a selection of the Viewport then populate the Field with the scale in the format we use.

I can do so manually and include a North Arrow in our template that already has the formula in the Field. This would be for inserting a north arrow after the fact.

The final formula is: %<\AcExpr (1/%<\_FldPtr 1995502088832>%) \f "%lu2%zs8">%

Appreciate any insight anyone can give.

Thank you!

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: LISP to link a field to VPORT scale
« Reply #1 on: February 24, 2024, 04:48:24 PM »
For every object in a dwg this will change 1995502088832 so making the  field string needs say some lisp to get object ID.

Code: [Select]
(setq obj (vlax-ename->vla-object (car  (entsel "Pick viewport "))))
(itoa (vla-get-objectid obj))

A man who never made a mistake never made anything

Gambit80

  • Mosquito
  • Posts: 2
Re: LISP to link a field to VPORT scale
« Reply #2 on: February 25, 2024, 08:37:33 AM »
Yes, sorry. I did know that would change, just showing the final output.

The process of getting that info (scale) into the field has been the issue. I will play with this and see what I can do.

Thank you.
« Last Edit: February 25, 2024, 08:48:48 AM by Gambit80 »

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: LISP to link a field to VPORT scale
« Reply #3 on: February 26, 2024, 01:43:45 AM »
Something like this for scale

%<\AcObjProp Object(%<\_ObjId 1056595104>%).CustomScale \f "%lu2%qf2816">%
A man who never made a mistake never made anything