Author Topic: How to select dim style using active x. Help!  (Read 1260 times)

0 Members and 1 Guest are viewing this topic.

abe123456789

  • Newt
  • Posts: 24
How to select dim style using active x. Help!
« on: April 19, 2022, 10:31:43 PM »
I created a line using vla-Addline and then used vla-addDimaligned  to add a dimension but I cannot figure out how to select which dimensions I want to use.
I want to make 2 dimension above and below the line. I have the 2 dimension style to do so but i can only use the current selected dimstyle.

Code: [Select]

(defun c:UGP (/ start end line1 dim1 a)
  (setq Start (getpoint "\nStart point of path: "))
  (setq end (getpoint start "\nEndpoint of path: "))

(setq *ModelSpace*
      (vla-get-ModelSpace
        (vla-get-ActiveDocument (vlax-get-acad-object))
      )

(setq line1
        (vla-Addline
          *ModelSpace* 
          start end
        )
  )
(vla-AddDimAligned *ModelSpace* start end end))
)
 


BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: How to select dim style using active x. Help!
« Reply #1 on: April 20, 2022, 12:31:38 AM »
Try

(command "dimstyle" "r" "yourdimstyle")
A man who never made a mistake never made anything

abe123456789

  • Newt
  • Posts: 24
Re: How to select dim style using active x. Help!
« Reply #2 on: April 20, 2022, 08:35:47 AM »
I have tried that can’t figure it out

ronjonp

  • Needs a day job
  • Posts: 7527
Re: How to select dim style using active x. Help!
« Reply #3 on: April 20, 2022, 10:26:43 AM »
You need to get your code working before you go onto the next task.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

mhupp

  • Bull Frog
  • Posts: 250
Re: How to select dim style using active x. Help!
« Reply #4 on: April 20, 2022, 11:34:42 AM »
I have tried that can’t figure it out

are you trying to switch to a dimstyle that isn't loaded/saved?

Code - Auto/Visual Lisp: [Select]
  1. (if (tblsearch "DIMSTYLE" "stylename")
  2.   (command "-dimstyle" "restore" "stylename")
  3.   (princ "\nDimstyle not found")
  4. )

abe123456789

  • Newt
  • Posts: 24
Re: How to select dim style using active x. Help!
« Reply #5 on: April 20, 2022, 12:46:10 PM »
Im trying to Draw a line then dim that line with 2 existing dim that are on the document.

mhupp

  • Bull Frog
  • Posts: 250
Re: How to select dim style using active x. Help!
« Reply #6 on: April 20, 2022, 03:38:17 PM »
Prob be easier to upload a drawing with the line and dimensions you want.
----Edit why two dims? why not use primary/secondary in one dim?

abe123456789

  • Newt
  • Posts: 24
Re: How to select dim style using active x. Help!
« Reply #7 on: April 20, 2022, 10:51:11 PM »
How would you do that with one dim?

mhupp

  • Bull Frog
  • Posts: 250