- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi friends,
I'm having trouble using ssget to select a region on which I need to run MASSPROP. My code is below:
;Assign name of .mpr files to be created (setq FileName (strcat "SectionNumber" (itoa counter))) ;Select the region (setq Region (ssget "W" '(-50 50) '(50 -50))) ;(setq Region (entsel)) ;Pull the centroid coordinates out of the region's properties (setq centroid (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object (car Region)) "Centroid")))) ;Pull the Principal Directions out of the region's properties ;Note that the resulting list is in the form (x1 x2 y1 y2) ;Therefore, the user should chose the first and third inputs, or the second and fourth (setq PrDir (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object (car Region)) "PrincipalDirections")))) ;Selects the first and third values from the extracted Principal Directions (setq PrDirx (list (nth 0 PrDir) (nth 2 PrDir))) ;Set the USC such that the origin is at the centroid of the region, ;and the X-axis is along one of the Principal Directions (command "ucs" "_NON" centroid "_NON" PrDirx "") ;Run MASSPROP on the region and save the output to a file (command "_MASSPROP" Region "" "_Y" FileName)
You'll notice that I have the line "(setq Region (entsel)" commented out right now. When I un-comment that line, and comment out the "(setq Region (ssget "W" '(-50 50) '(50 -50)))" line instead, it does exactly what I want. For some reason, it doesn't like my use of ssget. I sometimes get "error: bad argument type: consp <Select set: ###>" or "error: bad point argument", and I can't figure out what's causing either of them.
I have tried adding Z coordinates to the points, adding two other points such that it reads (ssget "W" '(-50 -50) '(-50 50) '(50 50) '(50 -50)), adding "_NONE" between all of the points... nothing has worked so far. Any insight that anyone might have would be greatly appreciated! I have 183 regions to run MassPROP on... I don't really want to have to select each one individually using entsel!
PS. I am using Civil3D 2017, in case that matters!
Solved! Go to Solution.