AutoCAD CAD二次開發CAD VBA開發

2022-03-08 10:50:13 字數 6200 閱讀 3502

1樓:匿名使用者

dim blocknamest as string

sub dimdimaligned()

on error goto err

dim po(0 to 2) as double

dim pr(0 to 2) as double

dim var as variant

dim dimdimalign as acaddimrotated

dim blokname as string

dim ang as double

dim ldob as double

dim xdob as double

dim pth as string

var = thisdrawing.utility.getpoint(, vbcr & "指定第一條尺寸界線原點:")

po(0) = var(0): po(1) = var(1): po(2) = var(2)

var = thisdrawing.utility.getpoint(po, vbcr & "指定第二條尺寸界線原點:")

pr(0) = var(0): pr(1) = var(1): pr(2) = var(2)

xdob = pr(0) - po(0)

ldob = sqr(((pr(0) - po(0)) * (pr(0) - po(0))) + ((pr(1) - po(1)) * (pr(1) - po(1))))

ang = xdob / ldob

if pr(1) > po(1) then

ang = atn(-ang / sqr(-ang * ang + 1)) + 2 * atn(1)

end if

if pr(1) < po(1) then

ang = -atn(-ang / sqr(-ang * ang + 1)) + 2 * atn(1) - 180 * 3.1415926 / 180

end if

if pr(1) = po(1) and pr(0) < po(0) then

ang = 180 * 3.1415926 / 180

end if

if pr(1) = po(1) and pr(0) > po(0) then

ang = 0

end if

set dimdimalign = thisdrawing.modelspace.adddimrotated(po, pr, pr, ang)

err:

end sub

sub linkblok()

on error goto err

dim po(0 to 2) as double

dim pr(0 to 2) as double

dim var as variant

dim blokin as acadblockreference

dim blokname as string

dim ang as double

dim ldob as double

dim xdob as double

dim pth as string

dim ucsobj as acaducs

dim origin(0 to 2) as double

dim xaxispo(0 to 2) as double

dim yaxispo(0 to 2) as double

origin(0) = 0#: origin(1) = 0#: origin(2) = 0#

xaxispo(0) = 3: xaxispo(1) = 0: xaxispo(2) = 0

yaxispo(0) = 0: yaxispo(1) = 3: yaxispo(2) = 0

set ucsobj = thisdrawing.usercoordinatesystems.add(origin, xaxispo, yaxispo, "wucs")

thisdrawing.activeucs = ucsobj

blokname = thisdrawing.utility.getstring(false, vbcr & "輸入的塊名<" + blocknamest + ">: ")

if blokname = "" then blokname = blocknamest

pth = "d:\cad塊\" + blokname + ".dwg"

if dir(pth) <> "" then

blocknamest = blokname

dovar = thisdrawing.utility.getpoint(, vbcr & "選取圖塊放置點:")

po(0) = var(0): po(1) = var(1): po(2) = var(2)

set blokin = thisdrawing.modelspace.insertblock(po, pth, 1, 1, 1, 0)

var = thisdrawing.utility.getpoint(po, vbcr & "指定圖塊方向:")

pr(0) = var(0): pr(1) = var(1): pr(2) = var(2)

xdob = pr(0) - po(0)

ldob = sqr(((pr(0) - po(0)) * (pr(0) - po(0))) + ((pr(1) - po(1)) * (pr(1) - po(1))))

ang = xdob / ldob

if pr(1) > po(1) then

ang = atn(-ang / sqr(-ang * ang + 1)) + 2 * atn(1)

end if

if pr(1) < po(1) then

ang = -atn(-ang / sqr(-ang * ang + 1)) + 2 * atn(1) - 180 * 3.1415926 / 180

end if

if pr(1) = po(1) and pr(0) < po(0) then

ang = 180 * 3.1415926 / 180

end if

if pr(1) = po(1) and pr(0) > po(0) then

ang = 0

end if

blokin.rotate po, ang

loop

else

thisdrawing.utility.prompt vbcr & pth + "的檔案路徑不存在!"

end if

err:

end sub

sub linkblokr0()

on error goto err

dim po(0 to 2) as double

dim pr(0 to 2) as double

dim var as variant

dim blokin as acadblockreference

dim blokname as string

dim ang as double

dim ldob as double

dim xdob as double

dim pth as string

dim ucsobj as acaducs

dim origin(0 to 2) as double

dim xaxispo(0 to 2) as double

dim yaxispo(0 to 2) as double

origin(0) = 0#: origin(1) = 0#: origin(2) = 0#

xaxispo(0) = 3: xaxispo(1) = 0: xaxispo(2) = 0

yaxispo(0) = 0: yaxispo(1) = 3: yaxispo(2) = 0

set ucsobj = thisdrawing.usercoordinatesystems.add(origin, xaxispo, yaxispo, "wucs")

thisdrawing.activeucs = ucsobj

blokname = thisdrawing.utility.getstring(false, vbcr & "輸入的塊名<" + blocknamest + ">: ")

if blokname = "" then blokname = blocknamest

pth = "d:\cad塊\" + blokname + ".dwg"

if dir(pth) <> "" then

blocknamest = blokname

dovar = thisdrawing.utility.getpoint(, vbcr & "選取圖塊放置點:")

po(0) = var(0): po(1) = var(1): po(2) = var(2)

set blokin = thisdrawing.modelspace.insertblock(po, pth, 1, 1, 1, 0)

'var = thisdrawing.utility.getpoint(po, vbcr & "指定圖塊方向:")

'pr(0) = var(0): pr(1) = var(1): pr(2) = var(2)

pr(0) = 0#: pr(1) = 0#: pr(2) = 0#

xdob = pr(0) - po(0)

ldob = sqr(((pr(0) - po(0)) * (pr(0) - po(0))) + ((pr(1) - po(1)) * (pr(1) - po(1))))

ang = xdob / ldob

if pr(1) > po(1) then

ang = atn(-ang / sqr(-ang * ang + 1)) + 2 * atn(1)

end if

if pr(1) < po(1) then

ang = -atn(-ang / sqr(-ang * ang + 1)) + 2 * atn(1) - 180 * 3.1415926 / 180

end if

if pr(1) = po(1) and pr(0) < po(0) then

ang = 180 * 3.1415926 / 180

end if

if pr(1) = po(1) and pr(0) > po(0) then

ang = 0

end if

blokin.rotate po, ang

loop

else

thisdrawing.utility.prompt vbcr & pth + "的檔案路徑不存在!"

end if

err:

end sub

sub plinelenx()

on error goto err

dim plx as string

dim obj as acadentity

dim lentxt as acadtext

dim po(0 to 2) as double

dim var as variant

thisdrawing.utility.getentity obj, var, vbcr & "選取polyline物件:"

if obj.objectname = "acdbpolyline" then

plx = cstr(int(obj.length * 100) / 100)

var = thisdrawing.utility.getpoint(, vbcr & "選取文字放置點:")

po(0) = var(0): po(1) = var(1): po(2) = var(2)

set lentxt = thisdrawing.modelspace.addtext("heater len", po, 4)

lentxt.stylename = "heatertxt": lentxt.layer = "3"

po(0) = po(0): po(1) = po(1) - 6: po(2) = po(2)

set lentxt = thisdrawing.modelspace.addtext(plx, po, 4)

lentxt.stylename = "heatertxt": lentxt.layer = "3"

else

thisdrawing.utility.prompt vbcr & "選取物件無效!"

end if

err:

end sub

金蝶erp管理系統實施二次開發執行怎麼樣

樓主,你好!我是金蝶合作伙伴的員工,做過金蝶的售後 專案實施,現在在甲方做內部顧問,負責內部erp系統的維護 專案推進。在諮詢公司我們往往希望客戶能按照標準功能去實施,遇到客戶提出個性化的需求,我也會拒絕和引導 現在在企業,發現企業的需求往往不是一些標準功能就能滿足的,個性化的需求在金蝶k3 bos...

什麼是自動化辦公OA系統為什麼有二次開發

其實oa辦公系統是一個動態的概念,隨著計算機技術 通訊技術和網路技術的突飛猛進,關於oa辦公系統的描述也在不斷充實,至今還沒有人對其下過最權威 最科學 最全面 最準確的定義。當今世界是資訊 的知識經濟統治的時代,在這種情況下結合技術的各種進步所產生的oa辦公系統已與十幾年前的oa發生了很大的變化。如...

金碟K3軟體,二次開發要用什麼工具或軟體實行啊

k3本身包含k 3 bos二次開發平臺的,在開始 程式 k 3安裝目錄下可以找 k 3 bos開發平臺 是vb語言,基本上是視覺化開發,非常簡單。k 3新的業務單據也都是bos開發出來的。工具不重要 能解決問題就好了 當然vb很簡單的哪 k3 二次開發,主要是vb 軟體.簡單易學 從事金蝶實施,想學...