- UID
- 5280
- 积分
- 9466
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- <LispFunction("FIMGOLE")> _
- Public Function FIMGOLE(ByVal rbfArgs As ResultBuffer) As ResultBuffer
- '
- '>>>ARGUMENTOS DE ENTRADA
- Dim arInputArgs As Array
- arInputArgs = rbfArgs.AsArray
- Dim MYIMG As String = CStr(CType(arInputArgs.GetValue(0), TypedValue).Value)
- Dim MYANG As Single = CSng(CType(arInputArgs.GetValue(1), TypedValue).Value)
- '
- Dim IMGTMP As String = Path.GetDirectoryName(MYIMG) & "\myimg.jpg"
- Dim IMG As System.Drawing.Image = New Bitmap(MYIMG)
- Dim DW, DH As Integer
- If MYANG = 0 Then
- DW = 0
- DH = 0
- Else
- DW = 5
- DH = 5
- End If
- Dim retBMP As New Bitmap(IMG.Width + DW, IMG.Height + DH)
- retBMP.SetResolution(IMG.HorizontalResolution, IMG.VerticalResolution)
- Using g = Graphics.FromImage(retBMP)
- g.Clear(Drawing.Color.White)
- g.TranslateTransform(0, IMG.Height)
- g.RotateTransform(MYANG)
- g.TranslateTransform(0, -IMG.Height)
- g.DrawImage(IMG, New PointF(0, 0))
- End Using
- retBMP.Save(IMGTMP, ImageFormat.Jpeg)
- '
- Dim imge As Drawing.Image = Bitmap.FromFile(IMGTMP)
- Dim mem As New IO.MemoryStream
- imge.Save(mem, Imaging.ImageFormat.Jpeg)
- imge.Dispose()
- mem.Position = 0
- imge = Drawing.Image.FromStream(mem)
- Clipboard.SetImage(imge)
- '
- '<<<ARGUMENTOS DE SAIDA
- 'Use RTREAL (5001) for doubles
- 'Use RTSHORT (5003) for integers
- 'Use RTSTR (5005) for strings
- Dim rbfResult As ResultBuffer
- rbfResult = New ResultBuffer( _
- New TypedValue(CInt(5005), MYIMG))
- Return rbfResult
- End Function
- <LispFunction("FIMGIMP")> _
- Public Function FIMGIMP(ByVal rbfArgs As ResultBuffer) As ResultBuffer
- '
- '>>>ARGUMENTOS DE ENTRADA
- Dim arInputArgs As Array
- arInputArgs = rbfArgs.AsArray
- Dim MYSTR As String = CStr(CType(arInputArgs.GetValue(0), TypedValue).Value)
- Dim MYIMG As String = CStr(CType(arInputArgs.GetValue(1), TypedValue).Value)
- '
- Try
- Dim client As New WebClient()
- 'By default, the google static map api returns a png file
- client.DownloadFile(MYSTR, MYIMG)
- Catch
- End Try
- '
- '<<<ARGUMENTOS DE SAIDA
- 'Use RTREAL (5001) for doubles
- 'Use RTSHORT (5003) for integers
- 'Use RTSTR (5005) for strings
- Dim rbfResult As ResultBuffer
- rbfResult = New ResultBuffer( _
- New TypedValue(CInt(5005), MYIMG))
- Return rbfResult
- End Function
LISP代码:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (DEFUN C:IMGOLE ()
- (COMMAND "_UNDO" "_G")
- (SETQ #CAD (SUBSTR (GETVAR "ACADVER") 1 2))
- (COND
- ((= #CAD "17")(SETQ ARQUIVO "IMGOLENET3.DLL" ));ACAD 2007/2008/2009
- ((= #CAD "18")(SETQ ARQUIVO "IMGOLENET4.DLL" ));ACAD 2010/2011/2012
- ((= #CAD "19")(SETQ ARQUIVO "IMGOLENET4.DLL" ));ACAD 2013/2014
- ((= #CAD "20")(SETQ ARQUIVO "IMGOLENET45.DLL"));ACAD 2015/2016
- ((= #CAD "21")(SETQ ARQUIVO "IMGOLENET45.DLL"));ACAD 2017
- ((= #CAD "22")(SETQ ARQUIVO "IMGOLENET45.DLL"));ACAD 2018
- ((= #CAD "23")(SETQ ARQUIVO "IMGOLENET45.DLL"));ACAD 2019
- ( T (SETQ ARQUIVO "IMGOLENET45.DLL"));
- )
- (VL-CMDF "NETLOAD" (FINDFILE ARQUIVO))
- ;
- (SETQ LLISTA (SSGET "_X" (LIST (CONS 0 "IMAGE") )))
- (SETQ NN 0)
- (IF LLISTA
- (PROGN
- (FOREACH EEP (SSNAMEX LLISTA)
- (SETQ NN (+ NN 1))
- (SETQ LL (ENTGET (CADR EEP)))
- (SETQ PT (CDR (ASSOC 10 LL)))
- (SETQ PT11 (CDR (ASSOC 11 LL)))
- (SETQ PT12 (CDR (ASSOC 12 LL)))
- (SETQ IMG (CDR (ASSOC 1 (ENTGET (CDR (ASSOC 340 LL))))))
- (SETQ ANGG (RPG (ANGLE (LIST 0 0) PT11)))
- (SETQ ANGG (- 360.0 ANGG))
- (SETQ SCX (* 512 (DISTANCE (LIST 0 0) PT11)))
- (SETQ SCY (* 512 (DISTANCE (LIST 0 0) PT12)))
- (COMMAND "_IMAGE" "_D" (VL-FILENAME-BASE IMG))
- (IMGPASTE IMG PT ANGG)
- (SETQ ENTO (ENTLAST))
- (SETQ LISO (ENTGET ENTO))
- (SETQ PT10 (CDR (ASSOC 10 LISO)))
- (SETQ PT11 (CDR (ASSOC 11 LISO)))
- (SETQ DXO (- (CAR PT11) (CAR PT10)))
- (SETQ DYO (- (CADR PT10) (CADR PT11)))
- ;
- (COMMAND "_SCALE" ENTO "" PT (/ SCX DYO))
- (COMMAND "_DRAWORDER" (ENTLAST) "" "_B")
- )
- (SETVAR "OLEFRAME" 0)
- (COMMAND "_REGEN")
- (ALERT (STRCAT ">> " (ITOA NN) " << IMAGES CONVERTEDS."
- "\n"
- "\nOLEFRAME (System Variable)"
- "\n= 0 Frame is not displayed and not plotted"
- "\n= 1 Frame is displayed and is plotted"
- "\n= 2 Frame is displayed but is not plotted"
- "\n"
- "\nType U to back"
- )
- )
- )
- (ALERT (STRCAT ">> " (ITOA NN) " << IMAGES NOT FOUNDS."))
- )
- (COMMAND "_UNDO" "_E")
- (PRINC)
- )
- ;...
- (defun IMGPASTE (image-path 2d-insert-point image-angg / cmdecho elast nircmd-path x y )
- ;;;www.theswamp.org by MP Seagull
- (and
- (progn (setq elast (entlast)) t)
- (setq cmdecho (getvar 'cmdecho))
- (setvar 'cmdecho 0)
- (setq image-path (findfile image-path))
- (progn
- (FIMGOLE IMAGE-PATH image-angg) ;;;DLL
- (command ".pasteclip" (mapcar 'set '(x y) 2d-insert-point))
- )
- )
- (setvar 'cmdecho cmdecho)
- (not (equal elast (entlast)))
- )
- ;...
- (DEFUN GPR ($G) (* $G (/ PI 180)) )
- (DEFUN RPG ($R) (* $R (/ 180 PI)) )
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (PRINC)
|
|